frontend-plugin-api: allow duplicate route ref IDs
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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}'`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user