diff --git a/morph/react-dom.js b/morph/react-dom.js index d104d3f..3edf82a 100644 --- a/morph/react-dom.js +++ b/morph/react-dom.js @@ -73,6 +73,7 @@ export default ({ fromViewsValidate: 1, fromViewsAggregate: 1, }, + ignoredExpandedProps: [], profile, uses: [], testIdKey: 'data-testid', diff --git a/morph/react-native.js b/morph/react-native.js index 3ad3728..71a6f24 100644 --- a/morph/react-native.js +++ b/morph/react-native.js @@ -79,6 +79,7 @@ export default ({ fromViewsValidate: 1, fromViewsAggregate: 1, }, + ignoredExpandedProps: [], uses: [], use(block, isLazy = false) { if (isLazy) { diff --git a/morph/react/block-add-data.js b/morph/react/block-add-data.js index ad32944..761d17f 100644 --- a/morph/react/block-add-data.js +++ b/morph/react/block-add-data.js @@ -84,6 +84,9 @@ function addData(data, isAggregate, state) { maybeDataValidate(data, state) state.variables.push('})') data.variables.isValidInitial = dataIsValidInitialName + + state.ignoredExpandedProps.push('isValidInitial') + state.ignoredExpandedProps.push('isInvalidInitial') } if (data.uses.has('useDataIsValid')) { @@ -102,6 +105,9 @@ function addData(data, isAggregate, state) { } state.variables.push('})') data.variables.isValid = dataIsValidName + + state.ignoredExpandedProps.push('isValid') + state.ignoredExpandedProps.push('isInvalid') } } @@ -118,6 +124,8 @@ function addData(data, isAggregate, state) { maybeDataFormatOut(data, state) state.variables.push('})') data.variables.onChange = dataChangeName + + state.ignoredExpandedProps.push('onChange') } if (data.uses.has('useDataSubmit')) { @@ -131,6 +139,8 @@ function addData(data, isAggregate, state) { maybeDataContext(data, state) state.variables.push('})') data.variables.onSubmit = dataSubmitName + + state.ignoredExpandedProps.push('onSubmit') } if (data.uses.has('useDataIsSubmitting')) { @@ -144,6 +154,8 @@ function addData(data, isAggregate, state) { maybeDataContext(data, state) state.variables.push('})') data.variables.isSubmitting = dataIsSubmittingName + + state.ignoredExpandedProps.push('isSubmitting') } state.use('ViewsUseData') diff --git a/morph/react/get-expanded-props.js b/morph/react/get-expanded-props.js index e64b091..552d745 100644 --- a/morph/react/get-expanded-props.js +++ b/morph/react/get-expanded-props.js @@ -27,6 +27,7 @@ export default function getExpandedProps({ }) { let slots = state.slots .filter((slot) => !IGNORED_SLOTS.has(slot.name)) + .filter((slot) => !state.ignoredExpandedProps.includes(slot.name)) .map((slot) => { let maybeDefaultValue = slot.defaultValue === false || ignoreDefaultValues