cherrypick-interactive 1.14.2 → 1.14.3
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/package.json +1 -1
- package/src/tui/index.js +20 -3
package/package.json
CHANGED
package/src/tui/index.js
CHANGED
|
@@ -11,6 +11,14 @@ import { App } from './App.js';
|
|
|
11
11
|
*/
|
|
12
12
|
export function renderCommitSelector(commits, gitRawFn, { devBranch, mainBranch, since }) {
|
|
13
13
|
return new Promise((resolve) => {
|
|
14
|
+
let resolved = false;
|
|
15
|
+
const settle = (val) => {
|
|
16
|
+
if (!resolved) {
|
|
17
|
+
resolved = true;
|
|
18
|
+
resolve(val);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
14
22
|
const { unmount, waitUntilExit } = render(
|
|
15
23
|
createElement(App, {
|
|
16
24
|
commits,
|
|
@@ -19,16 +27,25 @@ export function renderCommitSelector(commits, gitRawFn, { devBranch, mainBranch,
|
|
|
19
27
|
mainBranch,
|
|
20
28
|
since,
|
|
21
29
|
onDone: (selectedHashes) => {
|
|
22
|
-
|
|
30
|
+
settle(selectedHashes);
|
|
23
31
|
},
|
|
24
32
|
}),
|
|
25
33
|
);
|
|
26
34
|
|
|
27
35
|
waitUntilExit().then(() => {
|
|
36
|
+
// Restore stdin so subsequent prompts (inquirer) work correctly.
|
|
37
|
+
// Ink pauses stdin on unmount which causes inquirer to immediately
|
|
38
|
+
// throw ExitPromptError ("Aborted by user").
|
|
39
|
+
if (process.stdin.isPaused()) {
|
|
40
|
+
process.stdin.resume();
|
|
41
|
+
}
|
|
28
42
|
// Fallback: if exited without calling onDone, resolve with empty
|
|
29
|
-
|
|
43
|
+
settle([]);
|
|
30
44
|
}).catch(() => {
|
|
31
|
-
|
|
45
|
+
if (process.stdin.isPaused()) {
|
|
46
|
+
process.stdin.resume();
|
|
47
|
+
}
|
|
48
|
+
settle([]);
|
|
32
49
|
});
|
|
33
50
|
});
|
|
34
51
|
}
|