Fixes crash on older app with same widget name (#4876)

This commit is contained in:
Kavin Venkatachalam 2022-12-05 17:22:31 +05:30 committed by GitHub
parent 49224f4e48
commit 3945e15b0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -290,7 +290,10 @@ export const Box = function Box({
setExposedVariable={(variable, value) => onComponentOptionChanged(component, variable, value)}
setExposedVariables={(variableSet) => onComponentOptionsChanged(component, Object.entries(variableSet))}
registerAction={(actionName, func, dependencies = []) => {
if (Object.keys(currentState?.components ?? {}).includes(component.name)) {
if (
Object.keys(currentState?.components ?? {}).includes(component.name) &&
currentState?.components[component.name].id === id
) {
if (!Object.keys(exposedVariables).includes(actionName)) {
func.dependencies = dependencies;
return onComponentOptionChanged(component, actionName, func);