Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinitialize hooks on reconnection #1018

Merged
merged 2 commits into from
Feb 21, 2022
Merged

Reinitialize hooks on reconnection #1018

merged 2 commits into from
Feb 21, 2022

Conversation

jonatanklosko
Copy link
Member

Closes #1015.

@jonatanklosko jonatanklosko merged commit 0386a03 into main Feb 21, 2022
@jonatanklosko jonatanklosko deleted the jk-reconnect branch February 21, 2022 19:39
end)
}

push_event(socket, "session_init", payload)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for a silly question, where is this event handled? I noticed we removed def handle_event("session_init" elsewhere in the PR.

Copy link
Member Author

@jonatanklosko jonatanklosko Feb 21, 2022

Choose a reason for hiding this comment

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

It's the flow that changed :D

Previously we would load the page, mount the JS hook and from there we would pushEvent("session_init", ...) to the server, so we needed handle_event, and the server would reply. We effectively did an additional roundtrip for the initial data.

Now we do the push_event directly from the server as part of the initialization, so it's transferred together with the render payload. Then we do handleEvent("session_init", ...) on the client to receive this data. This works, because LV first mounts the JS hooks and only then dispatches the events :)

Copy link
Contributor

Choose a reason for hiding this comment

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

beautiful, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notebook does not respond to key-presses after waking from sleep
3 participants