Skip to content

React 19 effects sync execution issues #721

@Serchinastico

Description

@Serchinastico

👋 Hi, while trying to update ink-ui and ink-testing-library to use the latest Ink v6 version, I noticed an issue with the timing useEffect hooks are executed.

While updating to React 19, the reconciler.updateComponent() call was replaced by reconciler.updateComponentSync() and reconciler.flushSyncWork() (changes). I'm no React expert, but I think this has to do with how React 19 now calls useEffect synchronously under certain circumstances (ref).

To keep it short: this change in the timing of hook execution causes an unnoticeable flicker in Ink's output when writing to stderr (which renders non-updated output, in some cases an empty string). It only happens when in debug mode, and it causes some tests in ink-testing-library to fail.

My intuition tells me this would be easily fixable by just re-rendering the tree rather than reusing the last output, but I need to run some tests and make sure that doesn't break anything else.

I'll be opening a PR soon to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions