We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd7a646 commit 0b99981Copy full SHA for 0b99981
src/routes/scripts.svelte
@@ -38,9 +38,11 @@
38
})
39
40
let searchValue = $page.query.get('search') ?? ''
41
-
42
- const handleSearchChange = (event: TextInputChangeEvent) =>
43
- (searchValue = event.detail.parsedValue)
+ let shouldUpdateUrlQuery = false
+ const handleSearchChange = (event: TextInputChangeEvent) => {
+ searchValue = event.detail.parsedValue
44
+ shouldUpdateUrlQuery = true
45
+ }
46
47
type DisplayedDocuments = { items: Set<number>; first: number; last: number }
48
const searchCache: {
@@ -69,7 +71,7 @@
69
71
searchCache[currentSearch] = displayedDocuments
70
72
}
73
- $: if (typeof window !== 'undefined') {
74
+ $: if (typeof window !== 'undefined' && shouldUpdateUrlQuery) {
75
window.history.replaceState(
76
null,
77
'',
0 commit comments