-
Hey everyone! I'm currently using the const [accessToken, setAccessToken, clearAccessToken] = useLocalStorage({
deserialize: (value) => value,
/**
* @note incompatible with SSR
*/
getInitialValueInEffect: false,
key: 'access-token',
serialize: (value) => value,
}); Whenever I make changes to the value using const login = async (data) => {
const token = await fetch(data);
setAccessToken(token);
};
...
// prints new value (e.g. 'abc123')
console.log('accessToken', accessToken); However, upon using const logout = async () => {
clearAccessToken();
};
...
// still prints old value (e.g. 'abc123')
console.log('accessToken', accessToken); I was unsure if this was an issue, so I decided to go with the discussion just in case. Here's the codesandbox to reproduce the issue I'm having. As a workaround, I replaced Anyone else went through this issue too? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Thanks for reporting, the issue will be fixed in one of the next patches |
Beta Was this translation helpful? Give feedback.
-
Fixed by #3298 |
Beta Was this translation helpful? Give feedback.
Thanks for reporting, the issue will be fixed in one of the next patches