Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

RuntimeError("Hook stack is in an invalid state") #1250

Answered by Archmonger
stevej2608 asked this question in Question
Discussion options

Hi,

When I load up my ReactPy server I'm getting RuntimeError("Hook stack is in an invalid state") exceptions. These seem to be occurring randomly, they are not page or action specific. I've disabled REACTPY_ASYNC_RENDERING and confirmed that the exceptions still occur when Layout._serial_render() is used. The server recovers by automatically re-rendering the page following the exception.

I've loaded up the server with a simple 'button-click' app using asyncio and multiple instances of
playwright. It fails every time. See test_loading.py

The problem only occurs when multiple Layout.aenter contexts are open.

I'd like to fix the problem and I'm looking for some pointers as to what might be causing it.

Cheers, Steve

You must be logged in to vote

I've seen this a few times as well.

This PR has a fix, but it needs to be pulled out into a smaller PR.

  • J - Bug fix for corrupted hook state - change hook state to a contextvar

On a similar note, _ThreadSafeQueue should probably be replaced with janus.

Replies: 1 comment · 1 reply

Comment options

I've seen this a few times as well.

This PR has a fix, but it needs to be pulled out into a smaller PR.

  • J - Bug fix for corrupted hook state - change hook state to a contextvar

On a similar note, _ThreadSafeQueue should probably be replaced with janus.

You must be logged in to vote
1 reply
@Archmonger
Comment options

New PR has been opened that uses the previously mentioned changes as a baseline

Answer selected by Archmonger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.