You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the above SWR hook as a replacement for useState and an object state (SWR API options). However partially updating the fallback data/initial data or mutating at least one of the fields doesnt work as expected. The playerState.repeat key is undefined although it is defined initially
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using the above SWR hook as a replacement for useState and an object state (SWR API options). However partially updating the fallback data/initial data or mutating at least one of the fields doesnt work as expected. The
playerState.repeat
key is undefined although it is defined initiallyHowever this issue doesnt occur when I switch to the useState hook; calling
toggleRepeat()
returns/mutates the initial valueIs that intended, or am I misunderstanding how SWR manages state?
Beta Was this translation helpful? Give feedback.
All reactions