Fix inital page load search
This commit is contained in:
parent
42a300de0a
commit
e844b67e45
1 changed files with 7 additions and 4 deletions
|
@ -15,7 +15,7 @@
|
||||||
import PostList from '$lib/PostList';
|
import PostList from '$lib/PostList';
|
||||||
|
|
||||||
const drawerStore = getDrawerStore();
|
const drawerStore = getDrawerStore();
|
||||||
const toastStore = getToastStore();
|
let initalSearch = true;
|
||||||
|
|
||||||
function onSearch() {
|
function onSearch() {
|
||||||
$loading = true;
|
$loading = true;
|
||||||
|
@ -25,11 +25,14 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($postSearchResults === null) {
|
|
||||||
onSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
lastSearch.subscribe(() => {
|
lastSearch.subscribe(() => {
|
||||||
|
if (initalSearch) {
|
||||||
|
initalSearch = false;
|
||||||
|
if ($postSearchResults === null) onSearch();
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
onSearch();
|
onSearch();
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue