diff --git a/assets/controllers/elements/datatables/datatables_controller.js b/assets/controllers/elements/datatables/datatables_controller.js index 1f688d43..67e8ef6e 100644 --- a/assets/controllers/elements/datatables/datatables_controller.js +++ b/assets/controllers/elements/datatables/datatables_controller.js @@ -68,8 +68,10 @@ export default class extends Controller { stateLoadCallback(settings) { const data = JSON.parse( localStorage.getItem(this.getStateSaveKey()) ); - //Do not save the start value (current page), as we want to always start at the first page on a page reload - data.start = 0; + if (data) { + //Do not save the start value (current page), as we want to always start at the first page on a page reload + data.start = 0; + } return data; } @@ -201,4 +203,4 @@ export default class extends Controller { return this.element.dataset.select ?? false; } -} \ No newline at end of file +}