Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setFixtureState(fixtureState => {
const fsProps = findFixtureStateProps(fixtureState, elementId);
if (!fsProps) {
console.warn(`Element id ${elementId} no longer exists`);
return fixtureState;
}
const { values } = fsProps;
return {
...fixtureState,
props: updateFixtureStateProps({
fixtureState,
elementId,
values: replaceOrAddItem(values, propVal => propVal.key === key, {
serializable: true,
key,
stringified: value
})
})
};
});
};
const [stateFxState] = getStateFixtureState(
fixtureState,
createElFxStateMatcher(decoratorId, elPath)
);
if (!stateFxState) {
console.warn(`State instance id ${decoratorId} no longer exists`);
return;
}
const { values } = stateFxState;
const state = updateStateFixtureState({
fixtureState,
decoratorId,
elPath,
values: replaceOrAddItem(values, value => value.key === key, {
serializable: true,
key,
stringified: value
})
});
postRendererRequest({
type: 'setFixtureState',
payload: {
rendererId: RENDERER_ID,
fixturePath,
fixtureStateChange: {
state
}
}
});
context.setState(prevState => ({
...prevState,
timedNotifications: {
timeoutId: createNotificationTimeout(context),
items: replaceOrAddItem(
getTimedNotifications(prevState),
i => i.id === notification.id,
notification
)
}
}));
}
setFixtureState(fixtureState => {
const instanceProps = {
instanceId,
componentName,
renderKey: DEFAULT_RENDER_KEY,
values: extractValuesFromObject(children.props)
};
return {
props: replaceOrAddItem(
getFixtureStateProps(fixtureState),
props => props.instanceId === instanceId,
instanceProps
)
};
});
}
setFixtureState(fixtureState => {
const instanceId = getInstanceId(this);
const componentName = getComponentName(getRefType(childRef));
const stateInstance = {
instanceId,
componentName,
values: extractValuesFromObject(componentState)
};
return {
state: replaceOrAddItem(
getFixtureStateState(fixtureState),
state => state.instanceId === instanceId,
stateInstance
)
};
}, this.scheduleStateCheck);
}
context.setState(prevState => ({
...prevState,
stickyNotifications: replaceOrAddItem(
prevState.stickyNotifications,
i => i.id === notification.id,
notification
)
}));
}