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
it('clears state in payload for function',()=>{constkey='clearNuxtState-test'conststate=useState(key,()=>'test')expect(state.value).toBe('test')clearNuxtState(()=>false)expect(state.value).toBe('test')clearNuxtState(k=>k===key)expect(state.value).toBeUndefined()})it('clears all state when no key is provided',()=>{conststate1=useState('clearNuxtState-test',()=>'test')conststate2=useState('clearNuxtState-test2',()=>'test')expect(state1.value).toBe('test')expect(state2.value).toBe('test')clearNuxtState()expect(state1.value).toBeUndefined()expect(state2.value).toBeUndefined()})
Describe the bug
clearNuxtState has a documented feature that lets you reset all state by providing no arguments, or filter on specific state using a function callback. Both are not working, because the useStatePrefix is not stripped from the existing keys when matching.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
Environment
Darwin
v20.5.1
3.7.4
3.9.0
2.6.3
pnpm@8.7.1
-
-
-
-
Reproduction
These tests fail:
Describe the bug
clearNuxtState
has a documented feature that lets you reset all state by providing no arguments, or filter on specific state using a function callback. Both are not working, because theuseStatePrefix
is not stripped from the existing keys when matching.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: