@@ -267,8 +267,8 @@ import BootstrapVue from "bootstrap-vue";
267267import { initFolderTableIcons } from " components/Libraries/icons" ;
268268import { DEFAULT_PER_PAGE , MAX_DESCRIPTION_LENGTH } from " components/Libraries/library-utils" ;
269269import UtcDate from " components/UtcDate" ;
270- import { Toast } from " composables/toast" ;
271270import { usePersistentRef } from " composables/persistentRef" ;
271+ import { Toast } from " composables/toast" ;
272272import { sanitize } from " dompurify" ;
273273import linkifyHtml from " linkify-html" ;
274274import { getAppRoot } from " onload/loadConfig" ;
@@ -319,8 +319,6 @@ export default {
319319 },
320320 },
321321 data () {
322- const perPageRef = usePersistentRef (" library-folder-per-page" , DEFAULT_PER_PAGE );
323-
324322 return {
325323 ... initialFolderState (),
326324 ... {
@@ -334,8 +332,7 @@ export default {
334332 folder_metadata: {},
335333 fields: fields,
336334 selectMode: " multi" ,
337- perPage: perPageRef .value ,
338- perPageRef,
335+ perPage: DEFAULT_PER_PAGE ,
339336 maxDescriptionLength: MAX_DESCRIPTION_LENGTH ,
340337 total_rows: 0 ,
341338 root: getAppRoot (),
@@ -347,7 +344,9 @@ export default {
347344 },
348345 watch: {
349346 perPage (newValue ) {
350- this .perPageRef .value = newValue;
347+ if (this .perPageRef ) {
348+ this .perPageRef .value = newValue;
349+ }
351350 this .fetchFolderContents ();
352351 },
353352 includeDeleted () {
@@ -362,6 +361,8 @@ export default {
362361 },
363362 created () {
364363 this .services = new Services ({ root: this .root });
364+ this .perPageRef = usePersistentRef (" library-folder-per-page" , DEFAULT_PER_PAGE );
365+ this .perPage = this .perPageRef .value ;
365366 this .getFolder (this .folder_id , this .page );
366367 },
367368 methods: {
@@ -375,6 +376,10 @@ export default {
375376 resetData () {
376377 const data = initialFolderState ();
377378 Object .keys (data).forEach ((k ) => (this [k] = data[k]));
379+ // Restore perPage from localStorage after reset
380+ if (this .perPageRef ) {
381+ this .perPage = this .perPageRef .value ;
382+ }
378383 },
379384 onSort (props ) {
380385 this .sortBy = props .sortBy ;
0 commit comments