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

useTransition pending states should be isolated in different Suspense boundaries #2098

Open
eknkc opened this issue Mar 12, 2024 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@eknkc
Copy link

eknkc commented Mar 12, 2024

Describe the bug

When you have multiple Suspense siblings with internal components calling useTransition, starting one transition shifts the pending signal to true inside all Suspense boundaries. Is this expected?

Your Example Website or App

https://playground.solidjs.com/anonymous/dac2d20e-5f9e-4bbc-be95-73ff967c88d2

Steps to Reproduce the Bug or Issue

Load https://playground.solidjs.com/anonymous/dac2d20e-5f9e-4bbc-be95-73ff967c88d2
Hit Start on one of the lines
All lines show Pending state

Expected behavior

Only the clicked line should show a pending state as it should be isolated in the Suspense boundary.

Screenshots or Videos

No response

Platform

Solid 1.8.15

Additional context

Let me know if I'm misunderstanding the functionality.

@ryansolid
Copy link
Member

Yes this is the current behavior. There is only one Transition and the pending state taps into that. I've wondered if this made sense. Like in React there is one Transition too but they only propagate it through the specific call that started it. Now we could do that too by creating a signal per, but the opposite problem can occur. I've come to think that separate is probably be better but I didn't know that 3 years ago when we first released the feature.

This is a breaking change though. So going to mark this as a 2.0 issue.

@ryansolid ryansolid added the enhancement New feature or request label Mar 12, 2024
@ryansolid ryansolid added this to the 2.0.0 milestone Mar 12, 2024
@eknkc
Copy link
Author

eknkc commented Mar 12, 2024

There is only one Transition and the pending state taps into that.

Oh I did not know about this. Thanks for the explanation.

Now that with that info, I realised that if I click buttons in quick succession, UI does not change for any lines until the final start call resolves. I guess this is also due to having a single global transition, batching things together? (React seems to do the same thing with use(promise) and useTransition)

Anyway, looking forward to 2.0 then :). Thanks.

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

2 participants