From b8c4bbc1964200c435aa5aafb37203133daf988b Mon Sep 17 00:00:00 2001 From: Anagh Hegde Date: Tue, 10 Sep 2024 14:01:42 +0530 Subject: [PATCH] chore: add uuid supported path (#36221) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Use the path variable from routes that supports both mongo object ids and UUIDs of pg. Fixes ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 66cf4fc1ff353111b1557f0967bb9cb0fe1fbbce > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Tue, 10 Sep 2024 08:19:39 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Introduced new constants for viewer paths to enhance clarity in path matching. - **Refactor** - Simplified logic for extracting base page IDs by replacing the old constant with more descriptive ones. --- app/client/src/ce/pages/Editor/Explorer/helpers.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/client/src/ce/pages/Editor/Explorer/helpers.tsx b/app/client/src/ce/pages/Editor/Explorer/helpers.tsx index 587f89bf636..0a1baac42ea 100644 --- a/app/client/src/ce/pages/Editor/Explorer/helpers.tsx +++ b/app/client/src/ce/pages/Editor/Explorer/helpers.tsx @@ -7,7 +7,9 @@ import { DATA_SOURCES_EDITOR_ID_PATH, matchBuilderPath, matchViewerPath, - BUILDER_VIEWER_PATH_PREFIX, + VIEWER_PATH, + VIEWER_CUSTOM_PATH, + VIEWER_PATH_DEPRECATED, } from "constants/routes"; import { @@ -80,11 +82,7 @@ export const getActionIdFromURL = () => { }; export function getAppViewerPageIdFromPath(path: string): string | null { - const regexes = [ - `${BUILDER_VIEWER_PATH_PREFIX}:applicationSlug/:pageSlug(.*\\-):basePageId`, // VIEWER_PATH - `${BUILDER_VIEWER_PATH_PREFIX}:customSlug(.*\\-):basePageId`, // VIEWER_CUSTOM_PATH - `/applications/:baseApplicationId/pages/:basePageId`, // VIEWER_PATH_DEPRECATED - ]; + const regexes = [VIEWER_PATH, VIEWER_CUSTOM_PATH, VIEWER_PATH_DEPRECATED]; for (const regex of regexes) { const match = matchPath<{ basePageId: string }>(path, { path: regex }); if (match?.params.basePageId) {