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';
|
||||
|
||||
const drawerStore = getDrawerStore();
|
||||
const toastStore = getToastStore();
|
||||
let initalSearch = true;
|
||||
|
||||
function onSearch() {
|
||||
$loading = true;
|
||||
|
@ -25,11 +25,14 @@
|
|||
});
|
||||
}
|
||||
|
||||
if ($postSearchResults === null) {
|
||||
onSearch();
|
||||
}
|
||||
|
||||
lastSearch.subscribe(() => {
|
||||
if (initalSearch) {
|
||||
initalSearch = false;
|
||||
if ($postSearchResults === null) onSearch();
|
||||
return
|
||||
}
|
||||
|
||||
onSearch();
|
||||
})
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue