Skip to content

Commit a22b108

Browse files
committed
fix: intentional going back fix.
1 parent 68c305f commit a22b108

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • platforms/pictique/client/src/routes/(protected)/post

platforms/pictique/client/src/routes/(protected)/post/+page.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
1313
let caption: string = $state('');
1414
let error: string = $state('');
15+
let isLeavingPostRoute = false;
1516
1617
$effect(() => {
17-
if (!uploadedImages.value || uploadedImages.value.length === 0) {
18+
if (!isLeavingPostRoute && (!uploadedImages.value || uploadedImages.value.length === 0)) {
1819
window.history.back();
1920
}
2021
});
@@ -59,6 +60,7 @@
5960
6061
beforeNavigate(({ to }) => {
6162
if (!to?.url.pathname.startsWith('/post')) {
63+
isLeavingPostRoute = true;
6264
if (uploadedImages.value) {
6365
revokeImageUrls(uploadedImages.value);
6466
uploadedImages.value = null;

0 commit comments

Comments
 (0)