actions: I can't tell if this is a bug or a feature

If I submit an action and then immediately re-route, the action is just gone. If the response is being streamed in, I can't observe the response on an effect from a component higher up than both the current and target routes. When I don't navigate, the effect in the higher component can see the data - no problem, but when a navigation occurs while the data is being streamed in, the effect stops reacting to the new content coming in. Remix had a similar issue with fetcher's (remix submissions) lifetime being tied to component lifecycle. They recently changed it with a future flag called v3_fetcherpersist. Is there an intended way to get around this? If so, I'd love some help guys.
17 Replies
smr.gg
smr.ggOP3w ago
If anyone on the team wants me to hop on a short call or watch a loom, I can do that. I love Solid!
brenelz
brenelz3w ago
Can you make a reproduction?
smr.gg
smr.ggOP3w ago
Sure gimme a sec @brenelz here
smr.gg
smr.ggOP3w ago
GitHub
GitHub - smrdotgg/solid-action-bug
Contribute to smrdotgg/solid-action-bug development by creating an account on GitHub.
smr.gg
smr.ggOP3w ago
took more than a sec i guess 😭
brenelz
brenelz3w ago
Thanks this is a good reproduction. I haven't used a stream like this so not sure Maybe it clears submission on navigation
smr.gg
smr.ggOP3w ago
seems to be Just tested it out with switching out components with <Show /> and all works fine. It's something to do with navigation that clears actions it looks like. i pushed the tests too if you'd like. You can just flip it with the button in the top right on the deployed link 👍
Brendonovich
Brendonovich3w ago
it's probably this part that gets called while navigating, @ryansolid is it intentional that all submissions are erased on navigate?
No description
smr.gg
smr.ggOP2w ago
It is that line! I can work with a local patch I made for now. Thanks for finding this for me @Brendonovich!! Wish you guys the best on figuring this one out. 💙💙
Atila
Atila2w ago
it looks like this has never had an issue created in the repo. I'll check the reproduction and try to write up an issue for us to track this properly (even if it's a wontfix, it's good to have it tracked within the repo) https://github.com/solidjs/solid-router/issues if anyone has time to do it before me, I'd appreciate! 🙏
GitHub
Issues · solidjs/solid-router
A universal router for Solid inspired by Ember and React Router - Issues · solidjs/solid-router
smr.gg
smr.ggOP2w ago
GitHub
actions: navigating while an action is inflight cuts off the Reacti...
Describe the bug In SolidStart, if a navigation occurs while we have inflight actions/mutations/submissions, the reactive system is cut off from any updates on the state of the submission. This can...
Atila
Atila2w ago
wow!!! Very thorough! Thanks a lot.
Brendonovich
Brendonovich2w ago
I'm gonna try implementing the reference counting and we can see how that goes, imo changing the behaviour of action isn't necessary
ryansolid
ryansolid2w ago
I think we might not even need to reference count It might be sufficient to just only clear submissions that aren't pending. I think reference counting might be tricky with the way we do filtering. Yeah it's trickier than that because this example doesn't actually wait.. so the action thinks it is done before it is. I don't think this example is right. It isn't really an action.
Brendonovich
Brendonovich2w ago
I tried the reference counting and it works, but maybe this use case just shouldn’t be supported and the action should return the stream instead of returning the signal?
smr.gg
smr.ggOP2w ago
The example's modeled after a <form /> that would post a prompt to an endpoint, and would get back the response from an LLM service.
ryansolid
ryansolid2w ago
An action is only accontable for what it undersands. In theory it could understand a stream but it has no way of understanding a signal in the sense of am I done since Signals have no sense of time.
Want results from more Discord servers?
Add your server