From 27e6404aba8f08b1995ba4bf91d54069059d412e Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 4 Oct 2022 12:27:37 +0200 Subject: [PATCH] core-app-api: fix index route gathering Signed-off-by: Patrik Oldsberg --- .changeset/cuddly-bikes-tease.md | 5 +++++ .../core-app-api/src/routing/collectors.stable.test.tsx | 8 ++++---- packages/core-app-api/src/routing/collectors.tsx | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .changeset/cuddly-bikes-tease.md diff --git a/.changeset/cuddly-bikes-tease.md b/.changeset/cuddly-bikes-tease.md new file mode 100644 index 0000000000..d3fc8bd1bb --- /dev/null +++ b/.changeset/cuddly-bikes-tease.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-app-api': patch +--- + +Fixed a bug where gathered index routes would fail to bind routable extensions. This would typically show up when placing a routable extension in the entity page overview tab. diff --git a/packages/core-app-api/src/routing/collectors.stable.test.tsx b/packages/core-app-api/src/routing/collectors.stable.test.tsx index f8f71a1a9a..de6f350cc9 100644 --- a/packages/core-app-api/src/routing/collectors.stable.test.tsx +++ b/packages/core-app-api/src/routing/collectors.stable.test.tsx @@ -301,7 +301,7 @@ describe('discovery', () => { HELLO }> - + @@ -322,8 +322,8 @@ describe('discovery', () => { [ref1, 'foo'], [ref2, 'foo'], [ref3, 'bar'], - [ref4, 'baz'], - [ref5, 'baz'], + [ref4, ''], + [ref5, ''], ]); expect(sortedEntries(routing.parents)).toEqual([ [ref1, undefined], @@ -337,7 +337,7 @@ describe('discovery', () => { routeObj( 'bar', [ref3], - [routeObj('baz', [ref4, ref5], [], 'gathered')], + [routeObj('', [ref4, ref5], [], 'gathered')], undefined, plugin, ), diff --git a/packages/core-app-api/src/routing/collectors.tsx b/packages/core-app-api/src/routing/collectors.tsx index 815ae534f1..0bf5e676a4 100644 --- a/packages/core-app-api/src/routing/collectors.tsx +++ b/packages/core-app-api/src/routing/collectors.tsx @@ -178,7 +178,7 @@ export const routingV2Collector = createCollector( } if (mountPoint) { - if (!ctx?.gatherPath) { + if (ctx?.gatherPath === undefined) { throw new Error( `Routable extension "${stringifyNode( node,