Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions cli/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,28 @@ async function main(): Promise<void> {
backgroundColor: 'transparent',
exitOnCtrlC: false,
})
createRoot(renderer).render(

const root = createRoot(renderer)

// React component tree to render
const app = (
<QueryClientProvider client={queryClient}>
<AppWithAsyncAuth />
</QueryClientProvider>,
</QueryClientProvider>
)

// Add resize event listener for terminal resize support on Windows PowerShell
// On Windows, the SIGWINCH signal may not fire reliably, so we listen to
// process.stdout 'resize' event to ensure the UI updates when the window is resized
if (process.stdout.isTTY) {
process.stdout.on('resize', () => {
// Re-render the React tree to update with new terminal dimensions
root.render(app)
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same JSX element reference may prevent re-renders on resize

The app JSX element is stored as a constant and reused when calling root.render(app) on resize. React's reconciliation compares the new element with the current one, and since it's the same object reference with identical props, React may bail out and skip re-rendering the component tree. This would prevent useTerminalDimensions from being called again to query updated dimensions. To force a re-render, the JSX should be created fresh each time (e.g., via a function that returns the JSX) or use a mechanism like a changing key prop to signal React that a re-render is needed.

Fix in Cursor Fix in Web

}

// Initial render
root.render(app)
}

void main()
Loading