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

Implement Suspense #4

Open
AdamRamberg opened this issue Jul 16, 2023 · 1 comment
Open

Implement Suspense #4

AdamRamberg opened this issue Jul 16, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@AdamRamberg
Copy link
Contributor

Implement Suspense, simlar to how Suspense in React / Solid. The challenge with this issue is that the fallback component will need to have a higher prio being mounted than the children on the Suspense will have to be rendered.

@AdamRamberg AdamRamberg added the enhancement New feature or request label Jul 16, 2023
@AdamRamberg
Copy link
Contributor Author

One idea is to add the following to FiberNode:

  • A bool called isInSuspenseTree - when using the suspense component, that corresponding FiberNode and all under it will be flagged.
  • An intcalled suspensionCount - which is incremented every time an ancestor is added to the fiber tree and / or rendered. It's decremented when an ancestor is mounted.
  • A bool called isSuspenseComponent - flagging what FiberNode is a suspense component.

We could then use a combination of a signal and an effect in the suspense component to trigger hooks etc. for when a sub tree is suspending or not.

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

No branches or pull requests

1 participant