Skip to content
Snippets Groups Projects
Commit 26098c6b authored by Art Lowel's avatar Art Lowel
Browse files

Throw an error when there are multiple components to render the same type/viewmode combination

parent 06d2ac74
No related branches found
No related tags found
No related merge requests found
import { hasNoValue } from '../empty.util';
import { hasNoValue, hasValue } from '../empty.util';
import { ElementViewMode } from '../view-mode';
export const DEFAULT_RELATIONSHIP_TYPE = 'Default';
......@@ -9,6 +9,9 @@ export function rendersRelationshipType(type: string, viewMode: ElementViewMode)
if (hasNoValue(map.get(viewMode))) {
map.set(viewMode, new Map());
}
if (hasValue(map.get(viewMode).get(type))) {
throw new Error(`There can't be more than one component to render Items of type "${type}" in view mode "${viewMode}"`);
}
map.get(viewMode).set(type, component);
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment