From 27cc17cd4ad5c44013b772dd7f4b4da35f200df0 Mon Sep 17 00:00:00 2001 From: bignutty <3515180-bignutty@users.noreply.gitlab.com> Date: Sat, 15 Mar 2025 17:33:43 +0100 Subject: [PATCH] fix invalid page state resolving --- labscore/cardstack/stack.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/labscore/cardstack/stack.js b/labscore/cardstack/stack.js index cbb1142..a1fb1bb 100644 --- a/labscore/cardstack/stack.js +++ b/labscore/cardstack/stack.js @@ -302,11 +302,20 @@ class DynamicCardStack { * @param {String} key */ getState(key) { - if (!this.pageState[this.rootIndex]) return null; - if (!this.pageState[this.rootIndex][key]) return null; + if (typeof(this.pageState[this.rootIndex]) == "undefined") return null; + if (typeof(this.pageState[this.rootIndex][key]) == "undefined") return null; return this.pageState[this.rootIndex][key]; } + /** + * Returns all page state. + * Only really intended for debugging purposes. + * @returns {Object} + */ + getAllCurrentState() { + return this.pageState[this.rootIndex]; + } + /** * Returns all page state. * Only really intended for debugging purposes.