@liiift-studio/deploy-vercel-from-sanity 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -288,6 +288,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
288
288
  const [deployments, setDeployments] = (0, import_react2.useState)([]);
289
289
  const [loadingInitial, setLoadingInitial] = (0, import_react2.useState)(true);
290
290
  const [triggering, setTriggering] = (0, import_react2.useState)(false);
291
+ const [clicked, setClicked] = (0, import_react2.useState)(false);
291
292
  const [canceling, setCanceling] = (0, import_react2.useState)(false);
292
293
  const [deployError, setDeployError] = (0, import_react2.useState)(null);
293
294
  const [showHistory, setShowHistory] = (0, import_react2.useState)(false);
@@ -320,6 +321,9 @@ function DeployItem({ target, token, onDelete, onEdit }) {
320
321
  (0, import_react2.useEffect)(() => {
321
322
  if (triggering && latest && latest.state !== void 0) setTriggering(false);
322
323
  }, [triggering, latest]);
324
+ (0, import_react2.useEffect)(() => {
325
+ if (triggering) setClicked(false);
326
+ }, [triggering]);
323
327
  const prevStateRef = (0, import_react2.useRef)(void 0);
324
328
  (0, import_react2.useEffect)(() => {
325
329
  const current = latest?.state;
@@ -358,6 +362,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
358
362
  }, [isActive, latest?.created]);
359
363
  const deploy = (0, import_react2.useCallback)(() => {
360
364
  setDeployError(null);
365
+ setClicked(true);
361
366
  setTriggering(true);
362
367
  void (async () => {
363
368
  try {
@@ -365,6 +370,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
365
370
  setTimeout(fetchDeployments, 2e3);
366
371
  } catch (err) {
367
372
  setTriggering(false);
373
+ setClicked(false);
368
374
  setDeployError(err instanceof Error ? err.message : "Deploy failed");
369
375
  }
370
376
  })();
@@ -448,7 +454,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
448
454
  }
449
455
  ),
450
456
  isActive && elapsed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui3.Flex, { align: "center", gap: 1, children: [
451
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Spinner, { muted: true }),
457
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Spinner, { muted: true, style: { marginLeft: 4 } }),
452
458
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, children: formatDuration(elapsed) })
453
459
  ] }) : !isActive && deployedAt ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, children: deployedAt }) : null
454
460
  ] })
@@ -694,7 +700,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
694
700
  text: "Deploy",
695
701
  tone: "primary",
696
702
  loading: triggering,
697
- disabled: isActive,
703
+ disabled: isActive || clicked,
698
704
  onClick: deploy,
699
705
  style: {
700
706
  flex: 1,
package/dist/index.mjs CHANGED
@@ -310,6 +310,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
310
310
  const [deployments, setDeployments] = useState2([]);
311
311
  const [loadingInitial, setLoadingInitial] = useState2(true);
312
312
  const [triggering, setTriggering] = useState2(false);
313
+ const [clicked, setClicked] = useState2(false);
313
314
  const [canceling, setCanceling] = useState2(false);
314
315
  const [deployError, setDeployError] = useState2(null);
315
316
  const [showHistory, setShowHistory] = useState2(false);
@@ -342,6 +343,9 @@ function DeployItem({ target, token, onDelete, onEdit }) {
342
343
  useEffect2(() => {
343
344
  if (triggering && latest && latest.state !== void 0) setTriggering(false);
344
345
  }, [triggering, latest]);
346
+ useEffect2(() => {
347
+ if (triggering) setClicked(false);
348
+ }, [triggering]);
345
349
  const prevStateRef = useRef(void 0);
346
350
  useEffect2(() => {
347
351
  const current = latest?.state;
@@ -380,6 +384,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
380
384
  }, [isActive, latest?.created]);
381
385
  const deploy = useCallback2(() => {
382
386
  setDeployError(null);
387
+ setClicked(true);
383
388
  setTriggering(true);
384
389
  void (async () => {
385
390
  try {
@@ -387,6 +392,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
387
392
  setTimeout(fetchDeployments, 2e3);
388
393
  } catch (err) {
389
394
  setTriggering(false);
395
+ setClicked(false);
390
396
  setDeployError(err instanceof Error ? err.message : "Deploy failed");
391
397
  }
392
398
  })();
@@ -470,7 +476,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
470
476
  }
471
477
  ),
472
478
  isActive && elapsed > 0 ? /* @__PURE__ */ jsxs3(Flex3, { align: "center", gap: 1, children: [
473
- /* @__PURE__ */ jsx3(Spinner3, { muted: true }),
479
+ /* @__PURE__ */ jsx3(Spinner3, { muted: true, style: { marginLeft: 4 } }),
474
480
  /* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, children: formatDuration(elapsed) })
475
481
  ] }) : !isActive && deployedAt ? /* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, children: deployedAt }) : null
476
482
  ] })
@@ -716,7 +722,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
716
722
  text: "Deploy",
717
723
  tone: "primary",
718
724
  loading: triggering,
719
- disabled: isActive,
725
+ disabled: isActive || clicked,
720
726
  onClick: deploy,
721
727
  style: {
722
728
  flex: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liiift-studio/deploy-vercel-from-sanity",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Sanity Studio plugin — trigger and monitor Vercel deployments with full status, history, and build logs. Supports v3, v4, and v5.",
5
5
  "license": "MIT",
6
6
  "author": "Liiift Studio",
@@ -31,6 +31,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
31
31
  const [deployments, setDeployments] = useState<VercelDeployment[]>([])
32
32
  const [loadingInitial, setLoadingInitial] = useState(true)
33
33
  const [triggering, setTriggering] = useState(false)
34
+ const [clicked, setClicked] = useState(false)
34
35
  const [canceling, setCanceling] = useState(false)
35
36
  const [deployError, setDeployError] = useState<string | null>(null)
36
37
  const [showHistory, setShowHistory] = useState(false)
@@ -70,6 +71,11 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
70
71
  if (triggering && latest && latest.state !== undefined) setTriggering(false)
71
72
  }, [triggering, latest])
72
73
 
74
+ // Clear clicked once triggering has propagated — loading animation takes over
75
+ useEffect(() => {
76
+ if (triggering) setClicked(false)
77
+ }, [triggering])
78
+
73
79
  // ── Deploy-complete toast ─────────────────────────────────────────────────
74
80
  const prevStateRef = useRef<string | undefined>(undefined)
75
81
  useEffect(() => {
@@ -112,6 +118,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
112
118
  // ── Actions ───────────────────────────────────────────────────────────────
113
119
  const deploy = useCallback(() => {
114
120
  setDeployError(null)
121
+ setClicked(true)
115
122
  setTriggering(true)
116
123
  void (async () => {
117
124
  try {
@@ -119,6 +126,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
119
126
  setTimeout(fetchDeployments, 2000)
120
127
  } catch (err) {
121
128
  setTriggering(false)
129
+ setClicked(false)
122
130
  setDeployError(err instanceof Error ? err.message : 'Deploy failed')
123
131
  }
124
132
  })()
@@ -233,7 +241,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
233
241
  )}
234
242
  {isActive && elapsed > 0 ? (
235
243
  <Flex align="center" gap={1}>
236
- <Spinner muted />
244
+ <Spinner muted style={{ marginLeft: 4 }} />
237
245
  <Text size={1} muted>{formatDuration(elapsed)}</Text>
238
246
  </Flex>
239
247
  ) : (!isActive && deployedAt) ? (
@@ -560,7 +568,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
560
568
  text="Deploy"
561
569
  tone="primary"
562
570
  loading={triggering}
563
- disabled={isActive}
571
+ disabled={isActive || clicked}
564
572
  onClick={deploy}
565
573
  style={{
566
574
  flex: 1,