Skip to content

Commit 5c1c166

Browse files
committed
docs: clarify what returning false in async autocomplete does
1 parent a43106d commit 5c1c166

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/site/src/routes/demo/autocomplete/_Async.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@
4646
// Pretend to be loading something...
4747
await new Promise((resolve) => setTimeout(resolve, 1000));
4848
49+
// This means the function was called again, so we should cancel.
4950
if (myCounter !== counter) {
50-
// This means the function was called again, so we should cancel.
51-
// This is how you tell Autocomplete to cancel this search. It won't
51+
// `return false` (or, more accurately, resolving the Promise object to
52+
// `false`) is how you tell Autocomplete to cancel this search. It won't
5253
// replace the results of any subsequent search that has already finished.
5354
return false;
5455
}

0 commit comments

Comments
 (0)