Skip to content

Commit 561c61d

Browse files
committed
fix(webapp): suppress sheet spinner on bg reload + uniquify form id
- UpsertScheduleForm: derive a per-schedule `useForm` id (`edit-schedule-{friendlyId}` vs `create-schedule`) so both sheets can coexist in the DOM without clashing `htmlFor` targets or conform's internal error routing. - ScheduleSheet: drop `detailFetcher.state === "loading"` from `isDetailLoading`. The stale-schedule and no-data-yet checks already cover the cases where we genuinely lack good data; a background reload (e.g. after enable/disable) now keeps the inspector visible with its current values until the fresh data arrives, instead of flashing a spinner.
1 parent f1da4da commit 561c61d

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

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

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,11 @@ function ScheduleSheet({
650650
// user clicked a different row) as loading — otherwise we briefly flash
651651
// the previous schedule's content while the new fetch is in flight.
652652
const isStaleSchedule = !!schedule && !!openScheduleId && schedule.friendlyId !== openScheduleId;
653+
// Only show the loading spinner when we actually lack good data —
654+
// background reloads (e.g. after enable/disable) keep the inspector
655+
// visible with its current values until the fresh data arrives.
653656
const isDetailLoading =
654-
detailFetcher.state === "loading" ||
655-
isStaleSchedule ||
656-
(!!openScheduleId && schedule === undefined);
657+
isStaleSchedule || (!!openScheduleId && detailFetcher.data === undefined);
657658
// Distinct from loading: the loader has resolved and the schedule is
658659
// genuinely gone (returned `null`, e.g. deleted externally).
659660
const isScheduleMissing =

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.schedules.new/route.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ export function UpsertScheduleForm({
181181

182182
const [form, { taskIdentifier, cron, timezone, externalId, environments, deduplicationKey }] =
183183
useForm({
184-
id: "create-schedule",
184+
// Disambiguate per-schedule so both sheets (create + edit) can
185+
// coexist without duplicate DOM ids breaking `htmlFor` / conform.
186+
id: schedule?.friendlyId ? `edit-schedule-${schedule.friendlyId}` : "create-schedule",
185187
// TODO: type this
186188
lastSubmission: lastSubmission as any,
187189
shouldRevalidate: "onSubmit",

0 commit comments

Comments
 (0)