Skip to content

Commit

Permalink
Enhance Unleash functionality by fetching data with CacheAndNetwork p…
Browse files Browse the repository at this point in the history
…olicy and refactor search team logic for improved clarity
  • Loading branch information
rbjornstad committed Dec 12, 2024
1 parent a0c6d47 commit 57a60fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/routes/team/[team]/(teamPages)/unleash/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
if ($createUnleashForTeam.errors) {
return;
}
Unleash.fetch({ policy: 'CacheAndNetwork' });
};
const allowTeamAccess = graphql(`
Expand Down Expand Up @@ -192,7 +194,7 @@
confirmText="Delete"
variant="danger"
bind:open={removeTeamConfirmOpen}
on:confirm={removeTeam}
onconfirm={removeTeam}
>
{#snippet header()}
<Heading>Remove team</Heading>
Expand Down Expand Up @@ -404,11 +406,9 @@
Enabling Unleash will create a new Unleash server for your team, and cost will be attributed
to your team.
</p>
<Tooltip content="Coming soon...">
<Button variant="secondary" size="medium" onclick={createNewUnleash} iconLeft={PlusIcon}>
Enable Unleash
</Button>
</Tooltip>
<Button variant="secondary" size="medium" onclick={createNewUnleash} iconLeft={PlusIcon}>
Enable Unleash
</Button>
</div>
{/if}

Expand Down
7 changes: 3 additions & 4 deletions src/routes/team/[team]/(teamPages)/unleash/SearchTeam.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { run } from 'svelte/legacy';
import { graphql, type SearchQuery$result, type TeamSearchQuery$result } from '$houdini';
import SearchResults from '$lib/SearchResults.svelte';
import { logEvent } from '$lib/amplitude';
Expand Down Expand Up @@ -39,7 +37,7 @@
}
}: Props = $props();
run(() => {
function searchTeam() {
if (timeout) {
clearTimeout(timeout);
timeout = null;
Expand All @@ -51,7 +49,7 @@
logEvent('search');
}, 500);
}
});
}
function on_key_up(event: KeyboardEvent) {
switch (event.key) {
Expand Down Expand Up @@ -113,6 +111,7 @@
}
}}
onkeyup={on_key_up}
oninput={searchTeam}
/>
{#if $store.data && showSearch}
<SearchResults {showSearch} data={hack($store.data)} {onSelected} bind:query {selected} />
Expand Down

0 comments on commit 57a60fb

Please sign in to comment.