Skip to content

Commit

Permalink
fix(web): back button on person page (#2566)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelheusschen authored May 25, 2023
1 parent 062e2ec commit 1c293a2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions web/src/routes/(user)/people/[personId]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { afterNavigate, goto } from '$app/navigation';
import { page } from '$app/stores';
import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte';
import EditNameInput from '$lib/components/faces-page/edit-name-input.svelte';
import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte';
Expand All @@ -22,10 +23,17 @@
export let data: PageData;
let isEditName = false;
let multiSelectAsset: Set<AssetResponseDto> = new Set();
let previousRoute: string = AppRoute.EXPLORE;
$: isMultiSelectionMode = multiSelectAsset.size > 0;
afterNavigate(({ from }) => {
// Prevent setting previousRoute to the current page.
if (from && from.route.id !== $page.route.id) {
previousRoute = from.url.href;
}
});
const handleNameChange = async (name: string) => {
try {
isEditName = false;
Expand Down Expand Up @@ -60,7 +68,7 @@
<ControlAppBar
showBackButton
backIcon={ArrowLeft}
on:close-button-click={() => goto(AppRoute.EXPLORE)}
on:close-button-click={() => goto(previousRoute)}
/>
{/if}

Expand Down

0 comments on commit 1c293a2

Please sign in to comment.