fix(web): broken search-bar during page load (#3548)

* fix: broken search-bar during page load

* fix: prevent race condition between go back and close search bar
This commit is contained in:
martin
2023-08-05 20:05:24 +02:00
committed by GitHub
parent 1f64649434
commit f1b92718d5
3 changed files with 15 additions and 6 deletions

View File

@@ -26,6 +26,7 @@
import { onDestroy, onMount } from 'svelte';
import { browser } from '$app/environment';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import { preventRaceConditionSearchBar } from '$lib/stores/search.store';
export let data: PageData;
@@ -53,7 +54,10 @@
if (!$showAssetViewer) {
switch (event.key) {
case 'Escape':
goto(previousRoute);
if (!$preventRaceConditionSearchBar) {
goto(previousRoute);
}
$preventRaceConditionSearchBar = false;
return;
}
}