1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-24 10:37:28 +02:00

fix(web): back button on person page (#2566)

This commit is contained in:
Michel Heusschen 2023-05-25 18:48:36 +02:00 committed by GitHub
parent 062e2eca6f
commit 1c293a2759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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';
@ -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;
@ -60,7 +68,7 @@
<ControlAppBar
showBackButton
backIcon={ArrowLeft}
on:close-button-click={() => goto(AppRoute.EXPLORE)}
on:close-button-click={() => goto(previousRoute)}
/>
{/if}