solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

Multi action result stuck in pending if there was a newer submission

Open pawelblaszczyk5 opened this issue 2 years ago • 1 comments

When there are multiple submissions to multi action that are pending, only the latest one will ever resolve. All the previous one will be stuck in pending for ever, even if the corresponding request finished.

Reproduction: https://stackblitz.com/edit/vitejs-vite-kuuenu?file=src/routes/index.tsx

You can quickly click the submit button few times and observe that only the latest one will finish

pawelblaszczyk5 avatar Oct 13 '22 19:10 pawelblaszczyk5

I found this line in the code and it seems to be responsible for this problem: https://github.com/solidjs/solid-start/blob/main/packages/start/data/createRouteAction.tsx#L179

I've got an idea what it's responsible for in standard createRouteAction. Though I'm not sure whether it should be there in multi action

pawelblaszczyk5 avatar Oct 13 '22 19:10 pawelblaszczyk5

Solved in #313

pawelblaszczyk5 avatar Oct 16 '22 07:10 pawelblaszczyk5

Hmm.. testing this I remember why I had it this way. To prevent excess thrashing. It basically waits for all settled to refetch the data. Transitions will hold them anyway... we should be clearing pending at this point is probably the issue. I will see if I can fix this better.

ryansolid avatar Oct 16 '22 07:10 ryansolid