Skip to content

Commit 0fdc507

Browse files
committed
fix(webapp): revalidate route loader after enable/disable + update
The toggle and update effects reloaded `detailFetcher` (refreshing the inspector inside the sheet) but didn't call `revalidator.revalidate()`, so the page-level loader's `scheduleList` stayed stale — the sidebar's Status/CRON/Next-run properties and the schedules mini-table didn't reflect the change. Brought both effects in line with the create and delete flows.
1 parent 35cab79 commit 0fdc507

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.tasks.scheduled.$taskParam

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.tasks.scheduled.$taskParam/route.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,20 +598,23 @@ function ScheduleSheet({
598598
if (mode === "edit" && editPath) editFetcher.load(editPath);
599599
}, [mode, editPath]);
600600

601-
// Reload inspector data so Enable/Disable label flips; toast on error.
601+
// Reload inspector data so Enable/Disable label flips; revalidate the
602+
// route loader so the sidebar's list/Overview stay in sync; toast on error.
602603
useEffect(() => {
603604
const data = activeToggleFetcher.data;
604605
if (activeToggleFetcher.state !== "idle" || !data) return;
605606
if (handledToggleRef.current === data) return;
606607
handledToggleRef.current = data;
607608
if (data.ok) {
608609
if (detailPath) detailFetcher.load(detailPath);
610+
revalidator.revalidate();
609611
} else if (data.message) {
610612
toast.error(data.message);
611613
}
612-
}, [activeToggleFetcher.state, activeToggleFetcher.data, detailPath, toast]);
614+
}, [activeToggleFetcher.state, activeToggleFetcher.data, detailPath, toast, revalidator]);
613615

614-
// Toast + back to inspect + reload so the inspector reflects the update.
616+
// Toast + back to inspect + reload + revalidate so both the inspector
617+
// and the sidebar reflect the update.
615618
useEffect(() => {
616619
const data = updateFetcher.data;
617620
if (updateFetcher.state !== "idle" || !data) return;
@@ -621,10 +624,11 @@ function ScheduleSheet({
621624
toast.success(data.message ?? "Schedule updated");
622625
setMode("inspect");
623626
if (detailPath) detailFetcher.load(detailPath);
627+
revalidator.revalidate();
624628
} else if (data.message) {
625629
toast.error(data.message);
626630
}
627-
}, [updateFetcher.state, updateFetcher.data, detailPath, toast]);
631+
}, [updateFetcher.state, updateFetcher.data, detailPath, toast, revalidator]);
628632

629633
// Toast + close + revalidate so the deleted row disappears.
630634
useEffect(() => {

0 commit comments

Comments
 (0)