We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 27856e1 commit dbdd3b3Copy full SHA for dbdd3b3
src/lib/stores/query-param-store.ts
@@ -84,10 +84,16 @@ export function createQueryParamStore<T>(opts: QueryParamStoreOptions<T>) {
84
};
85
86
let firstUrlCheck = true;
87
+ let current_params_value: string
88
89
const start = () => {
90
const unsubscribe_from_page_store = page.subscribe(({ url: { searchParams } }) => {
91
let value = searchParams.get(key);
92
+ if (current_params_value && value === current_params_value) {
93
+ if (log) console.info('query params are same value, skipping set')
94
+ return // don't emit store change if page navigation happened with same query params
95
+ }
96
+ current_params_value = value
97
98
// Set store value from url - skipped on first load
99
if (!firstUrlCheck) return setStoreValue(value);
0 commit comments