From b00abf80a9314189862753522d6e8e72f0c434a8 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 5 Jun 2023 14:37:30 +0200 Subject: [PATCH] Remove plugin key from Backstage route object. Signed-off-by: Eric Peterson --- .../core-app-api/src/routing/collectors.tsx | 7 +------ packages/core-app-api/src/routing/types.ts | 1 - .../core-plugin-api/src/analytics/Tracker.ts | 17 ++++++++++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/core-app-api/src/routing/collectors.tsx b/packages/core-app-api/src/routing/collectors.tsx index bd795d7947..c67e380c51 100644 --- a/packages/core-app-api/src/routing/collectors.tsx +++ b/packages/core-app-api/src/routing/collectors.tsx @@ -334,10 +334,6 @@ export const routingV1Collector = createCollector( 'core.plugin', ), ), - plugin: getComponentData( - node.props.element, - 'core.plugin', - ), }; parentChildren.push(currentObj); } else { @@ -364,8 +360,7 @@ export const routingV1Collector = createCollector( element: 'gathered', routeRefs: new Set(), children: [MATCH_ALL_ROUTE], - plugins: pluginSet(ctx?.obj?.plugin), - plugin: ctx?.obj?.plugin, + plugins: ctx?.obj?.plugins || new Set(), }; parentChildren.push(currentObj); } diff --git a/packages/core-app-api/src/routing/types.ts b/packages/core-app-api/src/routing/types.ts index 3515c70d5c..56b82e4b53 100644 --- a/packages/core-app-api/src/routing/types.ts +++ b/packages/core-app-api/src/routing/types.ts @@ -55,7 +55,6 @@ export interface BackstageRouteObject { path: string; routeRefs: Set; plugins: Set; - plugin?: BackstagePlugin; } export function isRouteRef( diff --git a/packages/core-plugin-api/src/analytics/Tracker.ts b/packages/core-plugin-api/src/analytics/Tracker.ts index 3a46b4e4d0..16eab4fa79 100644 --- a/packages/core-plugin-api/src/analytics/Tracker.ts +++ b/packages/core-plugin-api/src/analytics/Tracker.ts @@ -85,13 +85,16 @@ export class Tracker implements AnalyticsTracker { // Never fire the special "_routable-extension-rendered" internal event. if (action === routableExtensionRenderedEvent) { - // Instead, set it on the global store. - globalEvents.mostRecentRoutableExtensionRender = { - context: { - ...context, - extension: 'App', - }, - }; + // But keep track of it if we're delaying a `navigate` event for a + // a gathered route node type. + if (globalEvents.mostRecentGatheredNavigation) { + globalEvents.mostRecentRoutableExtensionRender = { + context: { + ...context, + extension: 'App', + }, + }; + } return; }