hooks icon indicating copy to clipboard operation
hooks copied to clipboard

useUrlState doesn't delete initialState when state is set to undefined

Open Gusis93 opened this issue 1 year ago • 1 comments

In relation to #890

When trying to delete a state, the state will always go back to its initial state

Steps to reproduce

  • Use the hook with an initial state
const [state, setState] = useUrlState({
   someState: 'Initial State
})
  • Try to delete said state:
setState({someState: undefined});

Expected:

  • someState is not anymore

Actual:

  • state is: {someState: 'Initial State'}

Gusis93 avatar May 13 '24 16:05 Gusis93

image 看文档的描述,其实删除就是还原,不知道是不是这个描述有问题?需要确认,是还原成默认值还是彻底删除。

askwuxue avatar Jul 11 '24 09:07 askwuxue