@liiift-studio/deploy-vercel-from-sanity 1.0.5 → 1.0.7

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
@@ -35,6 +35,7 @@ var import_icons5 = require("@sanity/icons");
35
35
 
36
36
  // src/components/DeployItem.tsx
37
37
  var import_react2 = require("react");
38
+ var import_react_dom = require("react-dom");
38
39
  var import_ui3 = require("@sanity/ui");
39
40
  var import_icons2 = require("@sanity/icons");
40
41
 
@@ -288,7 +289,6 @@ function DeployItem({ target, token, onDelete, onEdit }) {
288
289
  const [deployments, setDeployments] = (0, import_react2.useState)([]);
289
290
  const [loadingInitial, setLoadingInitial] = (0, import_react2.useState)(true);
290
291
  const [triggering, setTriggering] = (0, import_react2.useState)(false);
291
- const [clicked, setClicked] = (0, import_react2.useState)(false);
292
292
  const [canceling, setCanceling] = (0, import_react2.useState)(false);
293
293
  const [deployError, setDeployError] = (0, import_react2.useState)(null);
294
294
  const [showHistory, setShowHistory] = (0, import_react2.useState)(false);
@@ -321,9 +321,6 @@ function DeployItem({ target, token, onDelete, onEdit }) {
321
321
  (0, import_react2.useEffect)(() => {
322
322
  if (triggering && latest && latest.state !== void 0) setTriggering(false);
323
323
  }, [triggering, latest]);
324
- (0, import_react2.useEffect)(() => {
325
- if (triggering) setClicked(false);
326
- }, [triggering]);
327
324
  const prevStateRef = (0, import_react2.useRef)(void 0);
328
325
  (0, import_react2.useEffect)(() => {
329
326
  const current = latest?.state;
@@ -361,16 +358,16 @@ function DeployItem({ target, token, onDelete, onEdit }) {
361
358
  };
362
359
  }, [isActive, latest?.created]);
363
360
  const deploy = (0, import_react2.useCallback)(() => {
364
- setDeployError(null);
365
- setClicked(true);
366
- setTriggering(true);
361
+ (0, import_react_dom.flushSync)(() => {
362
+ setDeployError(null);
363
+ setTriggering(true);
364
+ });
367
365
  void (async () => {
368
366
  try {
369
367
  await triggerDeploy(target.url);
370
368
  setTimeout(fetchDeployments, 2e3);
371
369
  } catch (err) {
372
370
  setTriggering(false);
373
- setClicked(false);
374
371
  setDeployError(err instanceof Error ? err.message : "Deploy failed");
375
372
  }
376
373
  })();
@@ -700,7 +697,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
700
697
  text: "Deploy",
701
698
  tone: "primary",
702
699
  loading: triggering,
703
- disabled: isActive || clicked,
700
+ disabled: isActive,
704
701
  onClick: deploy,
705
702
  style: {
706
703
  flex: 1,
@@ -940,7 +937,7 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
940
937
  }
941
938
 
942
939
  // src/version.ts
943
- var VERSION = "1.0.0";
940
+ var VERSION = "1.0.7";
944
941
 
945
942
  // src/components/DeployTool.tsx
946
943
  var import_jsx_runtime6 = require("react/jsx-runtime");
package/dist/index.mjs CHANGED
@@ -21,6 +21,7 @@ import { TokenIcon, TrashIcon as TrashIcon2, WarningOutlineIcon as WarningOutlin
21
21
 
22
22
  // src/components/DeployItem.tsx
23
23
  import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2, useRef } from "react";
24
+ import { flushSync } from "react-dom";
24
25
  import {
25
26
  Card as Card2,
26
27
  Box as Box2,
@@ -310,7 +311,6 @@ function DeployItem({ target, token, onDelete, onEdit }) {
310
311
  const [deployments, setDeployments] = useState2([]);
311
312
  const [loadingInitial, setLoadingInitial] = useState2(true);
312
313
  const [triggering, setTriggering] = useState2(false);
313
- const [clicked, setClicked] = useState2(false);
314
314
  const [canceling, setCanceling] = useState2(false);
315
315
  const [deployError, setDeployError] = useState2(null);
316
316
  const [showHistory, setShowHistory] = useState2(false);
@@ -343,9 +343,6 @@ function DeployItem({ target, token, onDelete, onEdit }) {
343
343
  useEffect2(() => {
344
344
  if (triggering && latest && latest.state !== void 0) setTriggering(false);
345
345
  }, [triggering, latest]);
346
- useEffect2(() => {
347
- if (triggering) setClicked(false);
348
- }, [triggering]);
349
346
  const prevStateRef = useRef(void 0);
350
347
  useEffect2(() => {
351
348
  const current = latest?.state;
@@ -383,16 +380,16 @@ function DeployItem({ target, token, onDelete, onEdit }) {
383
380
  };
384
381
  }, [isActive, latest?.created]);
385
382
  const deploy = useCallback2(() => {
386
- setDeployError(null);
387
- setClicked(true);
388
- setTriggering(true);
383
+ flushSync(() => {
384
+ setDeployError(null);
385
+ setTriggering(true);
386
+ });
389
387
  void (async () => {
390
388
  try {
391
389
  await triggerDeploy(target.url);
392
390
  setTimeout(fetchDeployments, 2e3);
393
391
  } catch (err) {
394
392
  setTriggering(false);
395
- setClicked(false);
396
393
  setDeployError(err instanceof Error ? err.message : "Deploy failed");
397
394
  }
398
395
  })();
@@ -722,7 +719,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
722
719
  text: "Deploy",
723
720
  tone: "primary",
724
721
  loading: triggering,
725
- disabled: isActive || clicked,
722
+ disabled: isActive,
726
723
  onClick: deploy,
727
724
  style: {
728
725
  flex: 1,
@@ -973,7 +970,7 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
973
970
  }
974
971
 
975
972
  // src/version.ts
976
- var VERSION = "1.0.0";
973
+ var VERSION = "1.0.7";
977
974
 
978
975
  // src/components/DeployTool.tsx
979
976
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liiift-studio/deploy-vercel-from-sanity",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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",
@@ -1,5 +1,6 @@
1
1
  // Per-deploy-target card — shows status, build timer, history, cancel, deploy, copy URL, and error logs
2
2
  import { useState, useEffect, useCallback, useRef } from 'react'
3
+ import { flushSync } from 'react-dom'
3
4
  import {
4
5
  Card, Box, Stack, Flex, Text, Button, Tooltip, Badge, Spinner,
5
6
  MenuButton, Menu, MenuItem, Code, useToast,
@@ -31,7 +32,6 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
31
32
  const [deployments, setDeployments] = useState<VercelDeployment[]>([])
32
33
  const [loadingInitial, setLoadingInitial] = useState(true)
33
34
  const [triggering, setTriggering] = useState(false)
34
- const [clicked, setClicked] = useState(false)
35
35
  const [canceling, setCanceling] = useState(false)
36
36
  const [deployError, setDeployError] = useState<string | null>(null)
37
37
  const [showHistory, setShowHistory] = useState(false)
@@ -71,12 +71,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
71
71
  if (triggering && latest && latest.state !== undefined) setTriggering(false)
72
72
  }, [triggering, latest])
73
73
 
74
- // Clear clicked once triggering has propagated — loading animation takes over
75
- useEffect(() => {
76
- if (triggering) setClicked(false)
77
- }, [triggering])
78
-
79
- // ── Deploy-complete toast ─────────────────────────────────────────────────
74
+ //── Deploy-complete toast ─────────────────────────────────────────────────
80
75
  const prevStateRef = useRef<string | undefined>(undefined)
81
76
  useEffect(() => {
82
77
  const current = latest?.state
@@ -117,16 +112,16 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
117
112
 
118
113
  // ── Actions ───────────────────────────────────────────────────────────────
119
114
  const deploy = useCallback(() => {
120
- setDeployError(null)
121
- setClicked(true)
122
- setTriggering(true)
115
+ flushSync(() => {
116
+ setDeployError(null)
117
+ setTriggering(true)
118
+ })
123
119
  void (async () => {
124
120
  try {
125
121
  await triggerDeploy(target.url)
126
122
  setTimeout(fetchDeployments, 2000)
127
123
  } catch (err) {
128
124
  setTriggering(false)
129
- setClicked(false)
130
125
  setDeployError(err instanceof Error ? err.message : 'Deploy failed')
131
126
  }
132
127
  })()
@@ -568,7 +563,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
568
563
  text="Deploy"
569
564
  tone="primary"
570
565
  loading={triggering}
571
- disabled={isActive || clicked}
566
+ disabled={isActive}
572
567
  onClick={deploy}
573
568
  style={{
574
569
  flex: 1,
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Package version — keep in sync with package.json
2
- export const VERSION = '1.0.0'
2
+ export const VERSION = '1.0.7'