Closed kiyov09 closed 1 year ago
Ah, thanks very much for reporting this!
@gbj First of all thnx for your work on this. 💪
It's working now but only when combined with create_resource
. If I used create_local_resource
(which I'm doing in my project) the issue is still there.
Probably the new first_run
Cell needs to be read/modified inside the fallback
instead of the children
At least that works for me.
I can continue with this if you want.
Probably the new
first_run
Cell needs to be read/modified inside thefallback
instead of thechildren
At least that works for me.
I can continue with this if you want.
Ah okay! Want to make a PR?
Sure. I'll work on that tomorrow morning. Is that ok?
@gbj
Ok, I found what's the issue, but I don't know the proper way to fix it.
When on hydrate
mode, the first run happens on the server, which sends the initial HTML with the fallback on it ("Loading..." in this case). When it gets to the client, the prev_children
gets updated right away in the first run but it is an "invisible" element cause the resource is still pending (See screenshot below), so the fallback element sent by the server is removed.
Ah okay I'll take a look.
I noticed that the
Transition
component is not rendering thefallback
while the resource inside is still pending.Example Code
I was analyzing the code and seems to be related to this if-else block: https://github.com/leptos-rs/leptos/blob/4ff08f042b643d542546076edc748a0b4582cb55/leptos/src/transition.rs#L87-L91