DEV: Actually fix decorateWidget error checking logic (#24037)

We need to separate the `:before` / `:after` suffix before looking up in the registry 🤦‍♂️🤦‍♂️
This commit is contained in:
David Taylor 2023-10-20 17:54:15 +01:00 committed by GitHub
parent 6c6740bb19
commit b38715e605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -40,7 +40,8 @@ export function deleteFromRegistry(name) {
const _decorators = {};
export function decorateWidget(widgetName, cb) {
export function decorateWidget(decorateIdentifier, cb) {
const widgetName = decorateIdentifier.split(":")[0];
if (!_registry[widgetName]) {
// eslint-disable-next-line no-console
console.error(
@ -48,8 +49,8 @@ export function decorateWidget(widgetName, cb) {
`decorateWidget: Could not find widget '${widgetName}' in registry`
);
}
_decorators[widgetName] ??= [];
_decorators[widgetName].push(cb);
_decorators[decorateIdentifier] ??= [];
_decorators[decorateIdentifier].push(cb);
}
export function traverseCustomWidgets(tree, callback) {