This commit is contained in:
Jason 2020-11-30 20:04:15 +00:00
parent f670479bd7
commit 60e34935ee
3 changed files with 10 additions and 1 deletions

View File

@ -12,6 +12,7 @@
"compression": "^1.7.1", "compression": "^1.7.1",
"date-fns": "^2.16.1", "date-fns": "^2.16.1",
"isomorphic-fetch": "^3.0.0", "isomorphic-fetch": "^3.0.0",
"lodash": "^4.17.20",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"polka": "next", "polka": "next",
"sirv": "^1.0.0" "sirv": "^1.0.0"

View File

@ -1,4 +1,5 @@
<script> <script>
import { debounce } from 'lodash';
import { goto, prefetch } from "@sapper/app"; import { goto, prefetch } from "@sapper/app";
import { stores } from "@sapper/app"; import { stores } from "@sapper/app";
@ -12,7 +13,9 @@
q = value.query.q || ""; q = value.query.q || "";
}); });
async function handleSearch(event) { let handleSearch = debounce(_handleSearch);
async function _handleSearch(event) {
const url = `/search?q=${event.target.value}`; const url = `/search?q=${event.target.value}`;
await prefetch(url); await prefetch(url);
await goto(url); await goto(url);

View File

@ -1421,6 +1421,11 @@ locate-path@^3.0.0:
p-locate "^3.0.0" p-locate "^3.0.0"
path-exists "^3.0.0" path-exists "^3.0.0"
lodash@^4.17.20:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
lower-case@^1.1.1: lower-case@^1.1.1:
version "1.1.4" version "1.1.4"
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"