Skip to content

Attach Stack at setState Calls in DEV Mode #7387

@sebmarkbage

Description

@sebmarkbage

We have a queue for state transitions. There is a natural place for a new Error() stack frame to be stored there.

We could use this information to work our way back from errors to show information about which setState call was the source of the error.

Because of batching, it is not always possible to make the correct attribution. It could be one of several possible sources.

(Specifically I'd like to use this in Fiber when the starvation protection kicks in. We can show which state transition was kept getting deferred due to higher priority work.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions