File tree Expand file tree Collapse file tree
platforms/pictique/client/src/routes/(protected)/post Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- import { goto } from ' $app/navigation' ;
2+ import { beforeNavigate , goto } from ' $app/navigation' ;
33 import { SettingsTile , UploadedPostView } from ' $lib/fragments' ;
44 import { audience , uploadedImages } from ' $lib/store/store.svelte' ;
55 import { createPost } from ' $lib/stores/posts' ;
66 import { Button , Textarea } from ' $lib/ui' ;
77 import { revokeImageUrls } from ' $lib/utils' ;
88 import { formatSize , validateFileSize } from ' $lib/utils/fileValidation' ;
9- import { onDestroy } from ' svelte' ;
109
1110 const MAX_TOTAL_SIZE = 5 * 1024 * 1024 ; // 5MB total
1211 const MAX_FILE_SIZE = 1 * 1024 * 1024 ; // 1MB per individual image
5857 input .value = ' ' ;
5958 };
6059
61- onDestroy (() => {
62- if (uploadedImages .value ) {
63- revokeImageUrls (uploadedImages .value );
64- uploadedImages .value = null ;
60+ beforeNavigate (({ to }) => {
61+ if (! to ?.url .pathname .startsWith (' /post' )) {
62+ if (uploadedImages .value ) {
63+ revokeImageUrls (uploadedImages .value );
64+ uploadedImages .value = null ;
65+ }
6566 }
6667 });
6768
You can’t perform that action at this time.
0 commit comments