web: reset checker state on navigation to avoid stale enabled/options
When switching between checkers via the sidebar, plan.enabled retained the previous checker's values because the guard condition prevented re-initialization. Reset all derived state eagerly on checkerId change and always repopulate plan.enabled from fresh status.
This commit is contained in:
parent
3eca2f3800
commit
0a120a6d97
1 changed files with 10 additions and 1 deletions
|
|
@ -78,10 +78,19 @@
|
|||
});
|
||||
let scheduleCard = $state<{ save: () => Promise<void> } | undefined>(undefined);
|
||||
|
||||
$effect(() => {
|
||||
// Reset state when switching checkers
|
||||
checkerId;
|
||||
plan = { enabled: {} };
|
||||
resolvedStatus = null;
|
||||
optionValues = {};
|
||||
inheritedValues = {};
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
checkStatusPromise.then((status) => {
|
||||
resolvedStatus = status;
|
||||
if (status?.rules && Object.keys(plan.enabled ?? {}).length === 0) {
|
||||
if (status?.rules) {
|
||||
const enabled: Record<string, boolean> = {};
|
||||
for (const rule of status.rules) {
|
||||
if (rule.name) enabled[rule.name] = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue