clearOnDefault in custom parser #1341
Replies: 3 comments 1 reply
-
|
Likely this: The point of the eq function, for non-primitive types (like Date here), is to be able to check the value you set against the default value. By returning false, it can never detect this and therefore never clears it from the URL. |
Beta Was this translation helpful? Give feedback.
-
|
@franky47 what about the other simple one. it was straight forward: const [randomValues] = useQueryStates({
foo: parseAsString
.withDefault('foo-value')
.withOptions({ clearOnDefault: false }),
bar: parseAsString
.withDefault('bar-value')
.withOptions({ clearOnDefault: false }),
});
i actually want it to be shown in the url always, changed/default doesn't matter. but it doesn't show in url at all until i change. i know i can use useEffect but that comes with another cost as i have to fire an api call on dateRange change. |
Beta Was this translation helpful? Give feedback.
-
|
thanks for answers 🥂 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
what wrong i am doing here. i want to show default value in the url. when i change value it does get reflected but not on defualt value.
https://stackblitz.com/edit/vitejs-vite-dgxziane?file=src%2FApp.tsx
Beta Was this translation helpful? Give feedback.
All reactions