From 602ec5c49582981d1909f05a3305a961747a5d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 4 Mar 2019 17:29:00 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Only=20use=20page=20size=20from?= =?UTF-8?q?=20local=20storage=20if=20configured?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should be a conscious decision by whoever uses ItemListHelper since otherwise the size can never be changed again to a new default. Follow-up to #2620 --- src/octoprint/static/js/app/helpers.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/octoprint/static/js/app/helpers.js b/src/octoprint/static/js/app/helpers.js index a36c05d12..455644b26 100644 --- a/src/octoprint/static/js/app/helpers.js +++ b/src/octoprint/static/js/app/helpers.js @@ -1,4 +1,4 @@ -function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSorting, defaultFilters, exclusiveFilters, defaultPageSize) { +function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSorting, defaultFilters, exclusiveFilters, defaultPageSize, persistPageSize) { var self = this; self.listType = listType; @@ -8,6 +8,7 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor self.defaultFilters = defaultFilters; self.exclusiveFilters = exclusiveFilters; self.defaultPageSize = defaultPageSize; + self.persistPageSize = !!persistPageSize; self.searchFunction = undefined; @@ -337,7 +338,7 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor }; self._savePageSizeToLocalStorage = function(pageSize) { - if (self._initializeLocalStorage()) { + if (self._initializeLocalStorage() && self.persistPageSize) { localStorage[self.storageIds.pageSize] = pageSize; } }; @@ -345,7 +346,7 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor self.pageSize.subscribe(self._savePageSizeToLocalStorage); self._loadPageSizeFromLocalStorage = function() { - if (self._initializeLocalStorage) { + if (self._initializeLocalStorage() && self.persistPageSize) { self.pageSize(parseInt(localStorage[self.storageIds.pageSize])); } };