Skip to content

Commit

Permalink
Add refetchOnWindowFocus to project status queries (#6287)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpgreen2 authored Dec 18, 2024
1 parent 2713c3c commit 8e5b31f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@
.length > 0
);
},
refetchOnMount: true,
refetchOnWindowFocus: true,
},
},
);
$: hasResourceErrors = $hasResourceErrorsQuery.data;
$: projectParserQuery = useProjectParser(queryClient, instanceId);
$: projectParserQuery = useProjectParser(queryClient, instanceId, {
refetchOnMount: true,
refetchOnWindowFocus: true,
});
$: hasParseErrors =
$projectParserQuery?.data?.projectParser.state.parseErrors.length > 0;
</script>
Expand Down
21 changes: 16 additions & 5 deletions web-admin/src/features/projects/status/ProjectParseErrors.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@
import { createRuntimeServiceGetResource } from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
$: projectParserQuery = createRuntimeServiceGetResource($runtime.instanceId, {
"name.kind": ResourceKind.ProjectParser,
"name.name": SingletonProjectParserName,
});
$: ({ instanceId } = $runtime);
$: projectParserQuery = createRuntimeServiceGetResource(
instanceId,
{
"name.kind": ResourceKind.ProjectParser,
"name.name": SingletonProjectParserName,
},
{
query: {
refetchOnMount: true,
refetchOnWindowFocus: true,
},
},
);
$: ({ isLoading, isSuccess, data, error } = $projectParserQuery);
$: parseErrors = data?.resource?.projectParser.state.parseErrors;
Expand All @@ -30,7 +41,7 @@
{:else if isSuccess}
{#if parseErrors && parseErrors.length > 0}
<ul class="border rounded-sm">
{#each parseErrors as error}
{#each parseErrors as error (error.message)}
<li
class="flex gap-x-5 justify-between py-1 px-9 border-b border-gray-200 bg-red-50 font-mono last:border-b-0"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
let isReconciling = false;
$: ({ instanceId } = $runtime);
$: resources = createRuntimeServiceListResources(
$runtime.instanceId,
instanceId,
// All resource "kinds"
undefined,
{
Expand All @@ -30,6 +32,7 @@
);
},
refetchOnMount: true,
refetchOnWindowFocus: true,
refetchInterval: isReconciling ? 500 : false,
},
},
Expand Down

1 comment on commit 8e5b31f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.