From 530746bc7400bca74126cf8b524905195aa5e75f Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Tue, 25 Jun 2024 11:39:15 -0600 Subject: [PATCH] Ensure _customRouteId is available --- js/PageNavModel.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/PageNavModel.js b/js/PageNavModel.js index a4c8562..35c9fb2 100644 --- a/js/PageNavModel.js +++ b/js/PageNavModel.js @@ -44,7 +44,7 @@ class PageNavModel extends ComponentModel { // Get models, skipping any undefined types (ex. deprecated button types) // Find buttonModel from config._customRouteId if not found in defined type const buttonModel = buttonConfig._customRouteId - ? data.findById(buttonConfig._customRouteId) + ? this.getCustomRoutePage(buttonConfig._customRouteId) : buttonTypeModels[type]; if (!buttonModel) continue; @@ -140,6 +140,12 @@ class PageNavModel extends ComponentModel { } } + getCustomRoutePage(id) { + const buttonModel = data.findById(id); + if (!buttonModel || !buttonModel.get('_isAvailable')) return; + return buttonModel; + } + getPages() { const loopStyle = this.get('_loopStyle'); let descendants = (loopStyle === 'allPages')