1
0
Fork 0

[react] chore: Guard against undefined settings

This commit is contained in:
joostdecock 2025-04-28 07:06:35 +02:00
parent 5e5edd9d29
commit 663528fa36
17 changed files with 79 additions and 66 deletions

View file

@ -157,6 +157,7 @@ export const Editor = ({
* @param (object) props.config - The editor config
*/
const viewfinder = ({ design, designs, state, config }) => {
const { settings = {} } = state // Guard against undefined settings
/*
* Grab Design from props or state and make them extra props
*/
@ -174,7 +175,7 @@ const viewfinder = ({ design, designs, state, config }) => {
*/
const [measurementsOk, missingMeasurements] = hasRequiredMeasurements(
designs[design],
state.settings?.measurements
settings.measurements
)
if (missingMeasurements) extraProps.missingMeasurements = missingMeasurements