File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ export const useContentStore = defineStore('Content', () => {
196196 } ) ;
197197
198198 console . error ( 'Failed to load category:' , error ) ;
199+ clearState ( ) ;
199200 return false ;
200201 }
201202 }
@@ -216,6 +217,8 @@ export const useContentStore = defineStore('Content', () => {
216217
217218 if ( ! nextFolder ?. id ) {
218219 toast . add ( 'Invalid folder' , { type : 'danger' , description : `The folder '${ nextFolderName } ' does not exist.` } ) ;
220+ stateFolder . value = emptyFolder ;
221+ stateVideo . value = emptyMedia ;
219222 return false ;
220223 }
221224
@@ -293,18 +296,18 @@ export const useContentStore = defineStore('Content', () => {
293296 } ;
294297 }
295298
299+ function clearState ( ) {
300+ stateDirectory . value = emptyLibrary ;
301+ stateFolder . value = emptyFolder ;
302+ stateVideo . value = emptyMedia ;
303+ }
304+
296305 //#endregion
297306
298307 /**
299308 * Watches the current route and clears app state when leaving the video player page.
300309 */
301310 watch ( route , ( to ) => {
302- const clearState = ( ) => {
303- stateDirectory . value = emptyLibrary ;
304- stateFolder . value = emptyFolder ;
305- stateVideo . value = emptyMedia ;
306- } ;
307-
308311 if ( to . name !== 'home' ) {
309312 clearState ( ) ;
310313 }
You can’t perform that action at this time.
0 commit comments