diff --git a/src/hooks/use-input.ts b/src/hooks/use-input.ts index d081131bd..1ec748035 100644 --- a/src/hooks/use-input.ts +++ b/src/hooks/use-input.ts @@ -2,6 +2,7 @@ import {type Buffer} from 'node:buffer'; import {useEffect} from 'react'; import {isUpperCase} from 'is-upper-case'; import parseKeypress, {nonAlphanumericKeys} from '../parse-keypress.js'; +import reconciler from '../reconciler.js'; import useStdin from './use-stdin.js'; /** @@ -182,7 +183,10 @@ const useInput = (inputHandler: Handler, options: Options = {}) => { // If app is not supposed to exit on Ctrl+C, then let input listener handle it if (!(input === 'c' && key.ctrl) || !internal_exitOnCtrlC) { - inputHandler(input, key); + // @ts-expect-error TypeScript types for `batchedUpdates` require an argument, but React's codebase doesn't provide it and it works without it as exepected. + reconciler.batchedUpdates(() => { + inputHandler(input, key); + }); } };