From c89a7a261fede85b746dc7ad3936cf813bc9d8e6 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 22 May 2024 09:35:27 +0100 Subject: [PATCH] Ensure in-app navigation via navigate to action automatically prefixes URLs with slashes --- packages/client/src/utils/buttonActions.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index 0c3866768e..25e0892fc0 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -238,7 +238,13 @@ const triggerAutomationHandler = async action => { } } const navigationHandler = action => { - const { url, peek, externalNewTab } = action.parameters + let { url, peek, externalNewTab, type } = action.parameters + + // Ensure in-app navigation starts with a slash + if (type === "screen" && url && !url.startsWith("/")) { + url = `/${url}` + } + routeStore.actions.navigate(url, peek, externalNewTab) closeSidePanelHandler() }