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

Refactor the Runtime #2973

Closed
wants to merge 13 commits into from
Closed

Refactor the Runtime #2973

wants to merge 13 commits into from

Conversation

matthunz
Copy link
Contributor

@matthunz matthunz commented Sep 17, 2024

  • Only enter the Runtime once per frontend application.
  • Creates RuntimeState and redefines Runtime as a wrapper around it. This lets us simplify the external API without requiring users know how the Runtime is stored (similar to Tokio).
pub(crate) struct RuntimeState { ... }

#[derive(Clone)]
pub struct Runtime {
    pub(crate) state: Rc<RuntimeState>,
}
  • The current Runtime seems to use a thread-local stack of runtimes with a Vec. This replaces the stack with a single Option and adds a new Runtime::take method (to exit the current runtime and return it to the user, keeping that same behavior of a stack if desired)
  • Investigate fullstack suspense

@matthunz matthunz added core relating to the core implementation of the virtualdom tweak Small changes to improve experience labels Sep 17, 2024
@matthunz matthunz changed the title Replace thread-local runtime stack with Option Refactor the Runtime Sep 17, 2024
@matthunz matthunz marked this pull request as ready for review September 19, 2024 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core relating to the core implementation of the virtualdom tweak Small changes to improve experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants