correct null case

This commit is contained in:
Niels Lyngsø
2025-01-09 20:28:58 +01:00
parent f862736163
commit bd456a1dfa
2 changed files with 4 additions and 2 deletions

View File

@@ -59,7 +59,8 @@ export const UmbClassMixin = <T extends ClassConstructor<EventTarget>>(superClas
// Fallback to use a hash of the provided method, but only if the alias is undefined and there is a callback.
if (controllerAlias === undefined && callback) {
controllerAlias = simpleHashCode(callback.toString());
} else {
} else if (controllerAlias === null) {
// if value is null, then reset it to undefined. Null is used to explicitly tell that we do not want a controller alias. [NL]
controllerAlias = undefined;
}

View File

@@ -35,7 +35,8 @@ export const UmbElementMixin = <T extends HTMLElementConstructor>(superClass: T)
// Fallback to use a hash of the provided method, but only if the alias is undefined and there is a callback.
if (controllerAlias === undefined && callback) {
controllerAlias = simpleHashCode(callback.toString());
} else {
} else if (controllerAlias === null) {
// if value is null, then reset it to undefined. Null is used to explicitly tell that we do not want a controller alias. [NL]
controllerAlias = undefined;
}