mintree 0.2.3 → 0.2.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/commands/dashboard.js +25 -8
- package/package.json +1 -1
|
@@ -976,6 +976,26 @@ export default function Dashboard() {
|
|
|
976
976
|
async function confirmCreate(overlay) {
|
|
977
977
|
if (state.phase !== "ready")
|
|
978
978
|
return;
|
|
979
|
+
// Validate first so we don't flash a spinner just to immediately show
|
|
980
|
+
// a sync-fail message.
|
|
981
|
+
if (overlay.branchMode === "new" && !overlay.desc.trim()) {
|
|
982
|
+
setState({
|
|
983
|
+
...state,
|
|
984
|
+
overlay: { ...overlay, error: "Description is required." },
|
|
985
|
+
});
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
// Surface the spinner BEFORE the heavy sync work. runCreate /
|
|
989
|
+
// runCreateDetached both block the event loop (execSync: git fetch +
|
|
990
|
+
// worktree add + optional .mintree/init.sh — easily several seconds on
|
|
991
|
+
// slow remotes or a repo with a real init script). Without the
|
|
992
|
+
// setImmediate yield Ink wouldn't get to paint the spinner until after
|
|
993
|
+
// that work finished, leaving the user staring at a frozen overlay.
|
|
994
|
+
setState({
|
|
995
|
+
...state,
|
|
996
|
+
overlay: { ...overlay, error: null, pending: "Creating worktree..." },
|
|
997
|
+
});
|
|
998
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
979
999
|
const prompt = overlay.prompt.trim();
|
|
980
1000
|
const issueId = overlay.issue.issue.id;
|
|
981
1001
|
let result;
|
|
@@ -993,13 +1013,6 @@ export default function Dashboard() {
|
|
|
993
1013
|
}
|
|
994
1014
|
else {
|
|
995
1015
|
const desc = overlay.desc.trim();
|
|
996
|
-
if (!desc) {
|
|
997
|
-
setState({
|
|
998
|
-
...state,
|
|
999
|
-
overlay: { ...overlay, error: "Description is required." },
|
|
1000
|
-
});
|
|
1001
|
-
return;
|
|
1002
|
-
}
|
|
1003
1016
|
const branch = `${overlay.type}/${issueId}-${desc}`;
|
|
1004
1017
|
result = runCreate(branch, {
|
|
1005
1018
|
work: true,
|
|
@@ -1009,7 +1022,11 @@ export default function Dashboard() {
|
|
|
1009
1022
|
if (!result.ok) {
|
|
1010
1023
|
setState({
|
|
1011
1024
|
...state,
|
|
1012
|
-
overlay: {
|
|
1025
|
+
overlay: {
|
|
1026
|
+
...overlay,
|
|
1027
|
+
pending: null,
|
|
1028
|
+
error: result.message + (result.hint ? ` — ${result.hint}` : ""),
|
|
1029
|
+
},
|
|
1013
1030
|
});
|
|
1014
1031
|
return;
|
|
1015
1032
|
}
|
package/package.json
CHANGED