solid icon indicating copy to clipboard operation
solid copied to clipboard

useTransition pending states should be isolated in different Suspense boundaries

Open eknkc opened this issue 2 years ago • 2 comments

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.

eknkc avatar Mar 12 '24 15:03 eknkc

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 avatar Mar 12 '24 16:03 ryansolid

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.

eknkc avatar Mar 12 '24 17:03 eknkc