Skip to content

Commit 0522c84

Browse files
isaacroldanClaude Code
andcommitted
deps: upgrade ink from 6.2.0 to 6.8.0
Upgrade the Ink terminal UI framework to the latest version. Code changes required for compatibility: - Pass concurrent: true to inkRender() (new default behavior in 6.8.0) - Defer unmountInk() calls with setImmediate() so React 19 can flush batched state updates before the component tree is torn down - Adapt waitUntilExit() return type change (.then(() => {})) Co-authored-by: Claude Code <claude-code@anthropic.com>
1 parent e36b6ab commit 0522c84

6 files changed

Lines changed: 69 additions & 37 deletions

File tree

packages/cli-kit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"graphql": "16.10.0",
140140
"graphql-request": "6.1.0",
141141
"ignore": "6.0.2",
142-
"ink": "6.2.0",
142+
"ink": "6.8.0",
143143
"is-executable": "2.0.1",
144144
"is-interactive": "2.0.0",
145145
"is-wsl": "3.1.0",

packages/cli-kit/src/private/node/testing/ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const render = (tree: ReactElement, options: RenderOptions = {}): Instanc
8181
rerender: instance.rerender,
8282
unmount: instance.unmount,
8383
cleanup: instance.cleanup,
84-
waitUntilExit: () => trackPromise(instance.waitUntilExit()),
84+
waitUntilExit: () => trackPromise(instance.waitUntilExit().then(() => {})),
8585
stdout,
8686
stderr,
8787
stdin,

packages/cli-kit/src/private/node/ui.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function renderOnce(element: JSX.Element, {logLevel = 'info', renderOptio
2727
}
2828

2929
export async function render(element: JSX.Element, options?: RenderOptions) {
30-
const {waitUntilExit} = inkRender(element, options)
30+
const {waitUntilExit} = inkRender(element, {...options, concurrent: true})
3131
await waitUntilExit()
3232
// We need to wait for other pending tasks -- unmounting of the ink component -- to complete
3333
return new Promise((resolve) => setImmediate(resolve))

packages/cli-kit/src/private/node/ui/components/SingleTask.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ const SingleTask = <T,>({task, title, onComplete, onAbort, noColor}: SingleTaskP
3535
.then((result) => {
3636
setIsDone(true)
3737
onComplete?.(result)
38-
unmountInk()
38+
// Defer unmount so React 19 can flush batched state updates
39+
// before the component tree is torn down.
40+
setImmediate(() => unmountInk())
3941
})
4042
.catch((error) => {
4143
setIsDone(true)
42-
unmountInk(error)
44+
setImmediate(() => unmountInk(error))
4345
})
4446
}, [task, unmountInk, onComplete])
4547

packages/cli-kit/src/private/node/ui/hooks/use-async-and-unmount.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ export default function useAsyncAndUnmount(
1616
asyncFunction()
1717
.then(() => {
1818
onFulfilled()
19-
unmountInk()
19+
// Defer unmount so React 19 can flush batched state updates
20+
// before the component tree is torn down.
21+
setImmediate(() => unmountInk())
2022
})
2123
.catch((error) => {
2224
onRejected(error)
23-
unmountInk(error)
25+
setImmediate(() => unmountInk(error))
2426
})
2527
}, [])
2628
}

pnpm-lock.yaml

Lines changed: 58 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)