fix: race condition when changing view
This commit is contained in:
@ -82,6 +82,7 @@
|
|||||||
let hideSearch = $state(false);
|
let hideSearch = $state(false);
|
||||||
|
|
||||||
let CurrentView: Component = $state(LoadingSidebar);
|
let CurrentView: Component = $state(LoadingSidebar);
|
||||||
|
let currentProps = $state({});
|
||||||
const modules = import.meta.glob("./sidebar/**/*.svelte");
|
const modules = import.meta.glob("./sidebar/**/*.svelte");
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
const path =
|
const path =
|
||||||
@ -97,6 +98,7 @@
|
|||||||
}
|
}
|
||||||
path().then((m) => {
|
path().then((m) => {
|
||||||
CurrentView = (m as { default: Component }).default;
|
CurrentView = (m as { default: Component }).default;
|
||||||
|
currentProps = view.current.props || {};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
@ -220,7 +222,7 @@
|
|||||||
{#if routing.currentTrip}
|
{#if routing.currentTrip}
|
||||||
<InRouteSidebar />
|
<InRouteSidebar />
|
||||||
{:else}
|
{:else}
|
||||||
<CurrentView {...view.current.props}></CurrentView>
|
<CurrentView {...currentProps}></CurrentView>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if !routing.currentTrip}
|
{#if !routing.currentTrip}
|
||||||
|
|||||||
Reference in New Issue
Block a user