Skip to content

Commit f60a6aa

Browse files
committed
fix(webapp): treat edit fetcher's prior-schedule data as stale
Mirrors the detail-fetcher staleness check: when the user opens schedule B's edit form after editing schedule A, the prior `editFetcher.data` no longer matches the open schedule's friendlyId — show the spinner instead of briefly flashing A's data.
1 parent 6675e0b commit f60a6aa

1 file changed

Lines changed: 6 additions & 1 deletion

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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,13 @@ function ScheduleSheet({
651651
const isScheduleMissing =
652652
!!openScheduleId && !isDetailLoading && detailFetcher.data?.schedule === null;
653653
const editData = editFetcher.data;
654+
// Mirror the detail-fetcher staleness check so the edit form doesn't
655+
// briefly flash a previously-edited schedule's data on the first render
656+
// after switching schedules.
657+
const isStaleEditData =
658+
!!editData?.schedule && !!openScheduleId && editData.schedule.friendlyId !== openScheduleId;
654659
const isEditLoading =
655-
mode === "edit" && (editFetcher.state === "loading" || !editData);
660+
mode === "edit" && (editFetcher.state === "loading" || !editData || isStaleEditData);
656661

657662
return (
658663
<Sheet open={!!openScheduleId} onOpenChange={(open) => !open && onClose()}>

0 commit comments

Comments
 (0)