frontend-plugin-api: allow duplicate route ref IDs

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2025-01-24 00:29:33 +01:00
parent 2dc6c738e1
commit 9ff33225fe
3 changed files with 7 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/frontend-plugin-api': patch
---
Allow route references to be installed in multiple app instances as long as their name is the same.
@@ -35,6 +35,7 @@ describe('RouteRef', () => {
internal.setId('some-id');
expect(String(internal)).toBe('RouteRef{some-id}');
internal.setId('some-id'); // Should allow same ID
expect(() => internal.setId('some-other-id')).toThrow(
"RouteRef was referenced twice as both 'some-id' and 'some-other-id'",
@@ -95,7 +95,7 @@ export class RouteRefImpl implements InternalRouteRef {
if (!id) {
throw new Error(`${this.#name} id must be a non-empty string`);
}
if (this.#id) {
if (this.#id && this.#id !== id) {
throw new Error(
`${this.#name} was referenced twice as both '${this.#id}' and '${id}'`,
);