mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 16:03:27 +00:00
preserve URL filter state on page refresh (#9680)
* fix(home): preserve URL filter state on page refresh ListFilters.loadFilterFromUrl() runs synchronously at script init and sets ownerFilter via binding. When $workspaceStore resolves asynchronously after mount it triggered the $effect that resets ownerFilter, wiping the URL-loaded filter before the user saw any results. Skip the first $workspaceStore resolution using the same firstRun guard pattern already used in this file (firstWorkspaceRun). Workspace switches still correctly clear the filter. Fixes #9624 * refactor(home): reset filters on workspace change instead of first-run guard Track the previous workspace value and clear filters only when it actually changes, rather than skipping the first $workspaceStore resolution. Encodes the real invariant (reset on change) without depending on child/parent init ordering, and preserves URL-loaded filters on initial mount by construction. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
Ruben Fiszel
parent
c1f31c0e47
commit
960c55e1f3
@@ -329,11 +329,17 @@
|
||||
let allLabels = $derived(
|
||||
Array.from(new Set(combinedItems?.flatMap((x) => itemLabels(x)) ?? [])).sort()
|
||||
)
|
||||
let prevWorkspace: string | undefined = undefined
|
||||
// Clear filters only when the workspace actually changes. The initial
|
||||
// resolution must be left alone so URL-loaded filter values (set by
|
||||
// ListFilters.loadFilterFromUrl on mount) survive the async store settling.
|
||||
$effect(() => {
|
||||
if ($workspaceStore) {
|
||||
const ws = $workspaceStore
|
||||
if (ws && prevWorkspace !== undefined && ws !== prevWorkspace) {
|
||||
ownerFilter = undefined
|
||||
labelFilter = undefined
|
||||
}
|
||||
prevWorkspace = ws
|
||||
})
|
||||
let preFilteredItems = $derived(
|
||||
ownerFilter != undefined
|
||||
|
||||
Reference in New Issue
Block a user