Skip to content

Commit 6740f27

Browse files
authored
fix(deploy-control): stabilize empty deployments selector (#33)
Replace inline `?? []` fallback with a module-scope readonly empty array so the zustand selector returns a stable reference, fixing the React 19 / Next.js 16 `getSnapshot should be cached to avoid an infinite loop` console error in DeployControl. Supersedes #25, #41, #42.
1 parent b699e8a commit 6740f27

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/components/deploy-control.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
type DeploymentRecord,
1010
} from "@/lib/store";
1111

12+
const EMPTY_DEPLOYMENTS: readonly DeploymentRecord[] = [];
13+
1214
/**
1315
* Publish-to-Vercel control rendered next to the preview-pane toolbar
1416
* actions. Renders three things in one rounded popover-anchor block:
@@ -31,7 +33,7 @@ export function DeployControl() {
3133
const html = useStore((s) => selectActiveTask(s)?.html ?? "");
3234
const taskId = useStore((s) => s.activeTaskId);
3335
const deployments = useStore(
34-
(s) => selectActiveTask(s)?.deployments ?? [],
36+
(s) => selectActiveTask(s)?.deployments ?? EMPTY_DEPLOYMENTS,
3537
);
3638
const removeDeploymentFor = useStore((s) => s.removeDeploymentFor);
3739
const t = useT();

0 commit comments

Comments
 (0)