swr icon indicating copy to clipboard operation
swr copied to clipboard

fix(cache): subscriptions not always called

Open belgac opened this issue 11 months ago • 2 comments

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.

belgac avatar Jul 17 '23 09:07 belgac

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

codesandbox-ci[bot] avatar Jul 17 '23 09:07 codesandbox-ci[bot]

Please provide a valid reproduction for this problem.

promer94 avatar Jul 17 '23 11:07 promer94

this is now fixed

belgac avatar Feb 23 '24 16:02 belgac