Skip to content

Commit c259bc1

Browse files
committed
fix: add missing dev environment guards to ScheduledTaskForm region select
1 parent cfd8490 commit c259bc1

File tree

1 file changed

+9
-3
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test.tasks.$taskParam

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,14 +1185,20 @@ function ScheduledTaskForm({
11851185
<Label htmlFor={region.id} variant="small">
11861186
Region
11871187
</Label>
1188+
{/* Our Select primitive uses Ariakit under the hood, which treats
1189+
value={undefined} as uncontrolled, keeping stale internal state when
1190+
switching environments. The key forces a remount so it reinitializes
1191+
with the correct defaultValue. */}
11881192
<Select
1193+
key={`region-${environment.id}`}
11891194
{...conform.select(region)}
11901195
variant="tertiary/small"
1196+
placeholder={isDev ? "–" : undefined}
11911197
dropdownIcon
11921198
items={regionItems}
1193-
defaultValue={defaultRegion?.name}
1194-
value={regionValue}
1195-
setValue={(e) => {
1199+
defaultValue={isDev ? undefined : defaultRegion?.name}
1200+
value={isDev ? undefined : regionValue}
1201+
setValue={isDev ? undefined : (e) => {
11961202
if (Array.isArray(e)) return;
11971203
setRegionValue(e);
11981204
}}

0 commit comments

Comments
 (0)