Skip to content

Commit 63b2919

Browse files
Merge pull request #20455 from dannon/persist-library-per-page
[25.0] Data Libraries - persist number of entries displayed in folders
2 parents 0167911 + ca8d869 commit 63b2919

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

client/src/components/Libraries/LibraryFolder/LibraryFolder.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ import BootstrapVue from "bootstrap-vue";
267267
import { initFolderTableIcons } from "components/Libraries/icons";
268268
import { DEFAULT_PER_PAGE, MAX_DESCRIPTION_LENGTH } from "components/Libraries/library-utils";
269269
import UtcDate from "components/UtcDate";
270+
import { usePersistentRef } from "composables/persistentRef";
270271
import { Toast } from "composables/toast";
271272
import { sanitize } from "dompurify";
272273
import linkifyHtml from "linkify-html";
@@ -342,7 +343,10 @@ export default {
342343
...mapState(useUserStore, ["currentUser"]),
343344
},
344345
watch: {
345-
perPage() {
346+
perPage(newValue) {
347+
if (this.perPageRef) {
348+
this.perPageRef.value = newValue;
349+
}
346350
this.fetchFolderContents();
347351
},
348352
includeDeleted() {
@@ -357,6 +361,8 @@ export default {
357361
},
358362
created() {
359363
this.services = new Services({ root: this.root });
364+
this.perPageRef = usePersistentRef("library-folder-per-page", DEFAULT_PER_PAGE);
365+
this.perPage = this.perPageRef.value;
360366
this.getFolder(this.folder_id, this.page);
361367
},
362368
methods: {
@@ -370,6 +376,10 @@ export default {
370376
resetData() {
371377
const data = initialFolderState();
372378
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+
}
373383
},
374384
onSort(props) {
375385
this.sortBy = props.sortBy;

0 commit comments

Comments
 (0)