Skip to content

Commit

Permalink
Make sure page navigation always works
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshino committed Jan 31, 2025
1 parent 6a3232a commit d203431
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib/components/global/toolbar/items/page-switcher.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import { _ } from 'svelte-i18n';
import { goto, selectedPageName } from '$lib/services/app/navigation';
import { selectedAssetFolder } from '$lib/services/assets';
import { siteConfig } from '$lib/services/config';
import { selectedCollection } from '$lib/services/contents/collection';
const pages = $derived([
{
key: 'collections',
label: $_('contents'),
icon: 'library_books',
link: `/collections/${$selectedCollection?.name}`,
link: `/collections/${$selectedCollection?.name ?? $siteConfig?.collections[0].name}`,
},
{
key: 'assets',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { SearchBar } from '@sveltia/ui';
import { _ } from 'svelte-i18n';
import { goBack, goto, parseLocation } from '$lib/services/app/navigation';
import { siteConfig } from '$lib/services/config';
import { selectedCollection } from '$lib/services/contents/collection';
import { searchTerms } from '$lib/services/search';
Expand All @@ -19,7 +20,7 @@
if (terms) {
goto(`/search/${terms}`, { replaceState: searching });
} else if (hadTerms && searching) {
goBack(`/collections/${$selectedCollection?.name}`);
goBack(`/collections/${$selectedCollection?.name ?? $siteConfig?.collections[0].name}`);
}
};
Expand Down

0 comments on commit d203431

Please sign in to comment.