swr
swr copied to clipboard
fix(cache): subscriptions not always called
since the fix applied in 2.0.4 we had problems in our codebase with some subscriptions not being called on some of our pages, it is the opposite problem of the applied fix (where subscriptions were removed from the array during the call). We were experiencing subscription being added to the subscription list while the subscritions were called. Those subscriptions weren't called because the array was cloned and the newer subscription weren't already present. We change the approach by not cloning the subscription array and iterating over it with a while depending on the length of the subscription array and guarding the call to the subscription itself with a typeof check.
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 5964d2d774d50135d9df935bae4d7c2f1535b61f:
Sandbox | Source |
---|---|
SWR-Basic | Configuration |
SWR-States | Configuration |
SWR-Infinite | Configuration |
SWR-SSR | Configuration |
Please provide a valid reproduction for this problem.
this is now fixed