diff --git a/packages/codegen-ui-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap b/packages/codegen-ui-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap index 1c56d47cc..9126c8eac 100644 --- a/packages/codegen-ui-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap +++ b/packages/codegen-ui-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap @@ -5731,100 +5731,240 @@ export default function SwitchControlledElement( } `; -exports[`amplify render tests mutations supports invalid statement names for mutation targets 1`] = ` +exports[`amplify render tests mutations supports all initial value binding types 1`] = ` Object { "componentText": "/* eslint-disable */ import React from \\"react\\"; import { EscapeHatchProps, + createDataStorePredicate, getOverrideProps, + useAuth, + useDataStoreBinding, useStateMutationAction, } from \\"@aws-amplify/ui-react/internal\\"; -import { Listing } from \\"../models\\"; -import { Flex, FlexProps, Image, Text } from \\"@aws-amplify/ui-react\\"; +import { User } from \\"../models\\"; +import { useEffect } from \\"react\\"; +import { Button, Flex, FlexProps, Heading, Text } from \\"@aws-amplify/ui-react\\"; -export type CardAProps = React.PropsWithChildren< +export type InitialValueBindingsProps = React.PropsWithChildren< Partial & { - listing?: Listing; + user?: User; } & { overrides?: EscapeHatchProps | undefined | null; } >; -export default function CardA(props: CardAProps): React.ReactElement { - const { listing, overrides, ...rest } = props; - const [classicLongSleeveTShirtChildren, setClassicLongSleeveTShirtChildren] = - useStateMutationAction(\\"Classic Long Sleeve T-Shirt\\"); - const Click = () => { - setClassicLongSleeveTShirtChildren(listing?.titl); +export default function InitialValueBindings( + props: InitialValueBindingsProps +): React.ReactElement { + const { user: userProp, overrides, ...rest } = props; + const authAttributes = useAuth().user?.attributes ?? {}; + const userFilterObj = { + field: \\"firstName\\", + operand: \\"Johnny\\", + operator: \\"eq\\", }; + const userFilter = createDataStorePredicate(userFilterObj); + const userDataStore = useDataStoreBinding({ + type: \\"collection\\", + model: User, + criteria: userFilter, + }).items[0]; + const user = userProp !== undefined ? userProp : userDataStore; + const [stateSourceChildren, setStateSourceChildren] = + useStateMutationAction(\\"State Value\\"); + const [fixedValueContentsChildren, setFixedValueContentsChildren] = + useStateMutationAction(\\"Fixed Value\\"); + const [boundValueContentsChildren, setBoundValueContentsChildren] = + useStateMutationAction(user?.lastName); + const [concatValueContentsChildren, setConcatValueContentsChildren] = + useStateMutationAction(\`\${\\"Concat\\"}\${\\" \\"}\${\\"Value\\"}\`); + const [ + conditionalValueContentsChildren, + setConditionalValueContentsChildren, + ] = useStateMutationAction( + user?.lastName && user?.lastName == \\"Bound Value\\" + ? \\"Conditional Value\\" + : \\"Unconditional Value\\" + ); + const [authValueContentsChildren, setAuthValueContentsChildren] = + useStateMutationAction(authAttributes[\\"email\\"]); + const [stateValueContentsChildren, setStateValueContentsChildren] = + useStateMutationAction(stateSourceChildren); + const fixedValueMutationClick = () => { + setFixedValueContentsChildren(\\"Mutated Value\\"); + }; + const boundValueMutationClick = () => { + setBoundValueContentsChildren(\\"Mutated Value\\"); + }; + const concatValueMutationClick = () => { + setConcatValueContentsChildren(\\"Mutated Value\\"); + }; + const conditionalValueMutationClick = () => { + setConditionalValueContentsChildren(\\"Mutated Value\\"); + }; + const authValueMutationClick = () => { + setAuthValueContentsChildren(\\"Mutated Value\\"); + }; + const stateValueMutationClick = () => { + setStateValueContentsChildren(\\"Mutated Value\\"); + }; + useEffect(() => { + setBoundValueContentsChildren(user?.lastName); + }, [user]); + useEffect(() => { + setConditionalValueContentsChildren( + user?.lastName && user?.lastName == \\"Bound Value\\" + ? \\"Conditional Value\\" + : \\"Unconditional Value\\" + ); + }, [user]); + useEffect(() => { + setAuthValueContentsChildren(authAttributes[\\"email\\"]); + }, [authAttributes]); return ( /* @ts-ignore: TS2322 */ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5836,154 +5976,6 @@ export default function CardA(props: CardAProps): React.ReactElement { } `; -exports[`amplify render tests mutations supports invalid statement names for mutation targets with ES5 1`] = ` -"var __assign = - (this && this.__assign) || - function () { - __assign = - Object.assign || - function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === \\"function\\") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if ( - e.indexOf(p[i]) < 0 && - Object.prototype.propertyIsEnumerable.call(s, p[i]) - ) - t[p[i]] = s[p[i]]; - } - return t; - }; -/* eslint-disable */ -import React from \\"react\\"; -import { - getOverrideProps, - useStateMutationAction, -} from \\"@aws-amplify/ui-react/internal\\"; -import { Flex, Image, Text } from \\"@aws-amplify/ui-react\\"; -export default function CardA(props) { - var listing = props.listing, - overrides = props.overrides, - rest = __rest(props, [\\"listing\\", \\"overrides\\"]); - var _a = useStateMutationAction(\\"Classic Long Sleeve T-Shirt\\"), - classicLongSleeveTShirtChildren = _a[0], - setClassicLongSleeveTShirtChildren = _a[1]; - var Click = function () { - setClassicLongSleeveTShirtChildren( - listing === null || listing === void 0 ? void 0 : listing.titl - ); - }; - return React.createElement( - Flex, - __assign( - { - gap: \\"16px\\", - direction: \\"column\\", - justifyContent: \\"center\\", - position: \\"relative\\", - padding: \\"0px 0px 0px 0px\\", - backgroundColor: \\"rgba(255,255,255,1)\\", - }, - rest, - getOverrideProps(overrides, \\"CardA\\") - ), - React.createElement( - Image, - __assign( - { - height: \\"400px\\", - shrink: \\"0\\", - alignSelf: \\"stretch\\", - position: \\"relative\\", - padding: \\"0px 0px 0px 0px\\", - }, - getOverrideProps(overrides, \\"image\\") - ) - ), - React.createElement( - Flex, - __assign( - { - gap: \\"8px\\", - direction: \\"column\\", - shrink: \\"0\\", - alignSelf: \\"stretch\\", - position: \\"relative\\", - padding: \\"0px 0px 0px 0px\\", - }, - getOverrideProps(overrides, \\"Text Grouping\\") - ), - React.createElement( - Text, - __assign( - { - fontFamily: \\"Inter\\", - fontSize: \\"16px\\", - fontWeight: \\"400\\", - color: \\"rgba(0,0,0,1)\\", - lineHeight: \\"24px\\", - textAlign: \\"left\\", - display: \\"flex\\", - direction: \\"column\\", - justifyContent: \\"flex-start\\", - letterSpacing: \\"0.01px\\", - shrink: \\"0\\", - alignSelf: \\"stretch\\", - position: \\"relative\\", - padding: \\"0px 0px 0px 0px\\", - whiteSpace: \\"pre-wrap\\", - children: classicLongSleeveTShirtChildren, - }, - getOverrideProps(overrides, \\"Classic Long Sleeve T-Shirt\\") - ) - ), - React.createElement( - Text, - __assign( - { - fontFamily: \\"Inter\\", - fontSize: \\"14px\\", - fontWeight: \\"400\\", - color: \\"rgba(43,51,59,1)\\", - lineHeight: \\"24px\\", - textAlign: \\"left\\", - display: \\"flex\\", - direction: \\"column\\", - justifyContent: \\"flex-start\\", - shrink: \\"0\\", - alignSelf: \\"stretch\\", - position: \\"relative\\", - padding: \\"0px 0px 0px 0px\\", - whiteSpace: \\"pre-wrap\\", - children: \\"$99\\", - onClick: function () { - Click(); - }, - }, - getOverrideProps(overrides, \\"$99\\") - ) - ) - ) - ); -} -" -`; - exports[`amplify render tests mutations supports multiple actions pointing to the same value 1`] = ` Object { "componentText": "/* eslint-disable */ diff --git a/packages/codegen-ui-react/lib/__tests__/studio-ui-codegen-react.test.ts b/packages/codegen-ui-react/lib/__tests__/studio-ui-codegen-react.test.ts index e63d3f422..d2af1a483 100644 --- a/packages/codegen-ui-react/lib/__tests__/studio-ui-codegen-react.test.ts +++ b/packages/codegen-ui-react/lib/__tests__/studio-ui-codegen-react.test.ts @@ -406,6 +406,8 @@ describe('amplify render tests', () => { script: ScriptKind.JS, }).componentText, ).toMatchSnapshot(); + it('supports all initial value binding types', () => { + expect(generateWithAmplifyRenderer('workflow/initialValueBindings')).toMatchSnapshot(); }); }); diff --git a/packages/codegen-ui-react/lib/imports/import-mapping.ts b/packages/codegen-ui-react/lib/imports/import-mapping.ts index e5e37cd98..b6bffab62 100644 --- a/packages/codegen-ui-react/lib/imports/import-mapping.ts +++ b/packages/codegen-ui-react/lib/imports/import-mapping.ts @@ -14,6 +14,7 @@ limitations under the License. */ export enum ImportSource { + REACT = 'react', UI_REACT = '@aws-amplify/ui-react', UI_REACT_INTERNAL = '@aws-amplify/ui-react/internal', AMPLIFY_DATASTORE = '@aws-amplify/datastore', @@ -38,6 +39,7 @@ export enum ImportValue { USE_DATA_STORE_DELETE_ACTION = 'useDataStoreDeleteAction', USE_AUTH_SIGN_OUT_ACTION = 'useAuthSignOutAction', USE_STATE_MUTATION_ACTION = 'useStateMutationAction', + USE_EFFECT = 'useEffect', } export const ImportMapping: Record = { @@ -58,4 +60,5 @@ export const ImportMapping: Record = { [ImportValue.USE_DATA_STORE_DELETE_ACTION]: ImportSource.UI_REACT_INTERNAL, [ImportValue.USE_AUTH_SIGN_OUT_ACTION]: ImportSource.UI_REACT_INTERNAL, [ImportValue.USE_STATE_MUTATION_ACTION]: ImportSource.UI_REACT_INTERNAL, + [ImportValue.USE_EFFECT]: ImportSource.REACT, }; diff --git a/packages/codegen-ui-react/lib/react-studio-template-renderer.ts b/packages/codegen-ui-react/lib/react-studio-template-renderer.ts index d5d48f123..3797332fe 100644 --- a/packages/codegen-ui-react/lib/react-studio-template-renderer.ts +++ b/packages/codegen-ui-react/lib/react-studio-template-renderer.ts @@ -77,6 +77,7 @@ import { buildUseActionStatement, mapSyntheticStateReferences, buildStateStatements, + buildUseEffectStatements, } from './workflow'; export abstract class ReactStudioTemplateRenderer extends StudioTemplateRenderer< @@ -605,6 +606,12 @@ export abstract class ReactStudioTemplateRenderer extends StudioTemplateRenderer statements.push(entry); }); + const useEffectStatements = buildUseEffectStatements(component, this.componentMetadata); + useEffectStatements.forEach((entry) => { + this.importCollection.addMappedImport(ImportValue.USE_EFFECT); + statements.push(entry); + }); + return statements; } diff --git a/packages/codegen-ui-react/lib/workflow/mutation.ts b/packages/codegen-ui-react/lib/workflow/mutation.ts index 68f2e9435..e9b512a64 100644 --- a/packages/codegen-ui-react/lib/workflow/mutation.ts +++ b/packages/codegen-ui-react/lib/workflow/mutation.ts @@ -24,6 +24,7 @@ import { StudioComponentProperty, ComponentMetadata, getComponentFromComponentTree, + computeStateReferenceMetadata, } from '@aws-amplify/codegen-ui'; import { isStateProperty, @@ -63,6 +64,43 @@ const PrimitiveDefaultValuePropMapping: PrimitiveLevelPropConfiguration }, ); +/** + * TODO: Determine if we should be initializing state values w/ these data deps to `undefined`, + * then only setting the value here in the useEffect once the dependencies are no longer null. + * + * This way we'll be able to still use the useEffect for an initialization once the data values have settled, + * and we won't overwrite whatever mutation applies to them if useAuth or useData changes. + */ +export function buildUseEffectStatements( + component: StudioComponent, + componentMetadata: ComponentMetadata, +): Statement[] { + const stateReferenceMetadata = computeStateReferenceMetadata(component, componentMetadata.stateReferences); + return stateReferenceMetadata + .filter(({ dataDependencies }) => dataDependencies.length > 0) + .map(({ stateReference, dataDependencies }) => { + return factory.createExpressionStatement( + factory.createCallExpression(factory.createIdentifier('useEffect'), undefined, [ + factory.createArrowFunction( + undefined, + undefined, + [], + undefined, + factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), + factory.createBlock([ + factory.createExpressionStatement( + factory.createCallExpression(factory.createIdentifier(getSetStateName(stateReference)), undefined, [ + getStateInitialValue(component, componentMetadata, stateReference), + ]), + ), + ]), + ), + factory.createArrayLiteralExpression(dataDependencies.map(factory.createIdentifier), false), + ]), + ); + }); +} + export function mapSyntheticStateReferences(componentMetadata: ComponentMetadata) { return componentMetadata.stateReferences.map((stateReference) => { const { componentName, property } = stateReference; diff --git a/packages/codegen-ui/example-schemas/workflow/initialValueBindings.json b/packages/codegen-ui/example-schemas/workflow/initialValueBindings.json new file mode 100644 index 000000000..d4df2e932 --- /dev/null +++ b/packages/codegen-ui/example-schemas/workflow/initialValueBindings.json @@ -0,0 +1,402 @@ +{ + "id": "1234-5678-9010", + "componentType": "Flex", + "name": "InitialValueBindings", + "properties": { + "direction": { + "value": "column" + } + }, + "bindingProperties": { + "user": { + "type": "Data", + "bindingProperties": { + "model": "User", + "predicate": { + "field": "firstName", + "operand": "Johnny", + "operator": "eq" + } + } + } + }, + "children": [ + { + "componentType": "Heading", + "name": "Heading", + "properties": { + "level": { + "value": 3 + }, + "label": { + "value": "Mutation Initial Value Bindings" + } + } + }, + { + "componentType": "Flex", + "name": "FixedValueInitialBindingSection", + "properties": { + "direction": { + "value": "row" + } + }, + "children": [ + { + "componentType": "Heading", + "name": "FixedValueHeading", + "properties": { + "level": { + "value": 5 + }, + "label": { + "value": "Fixed Initial Value" + } + } + }, + { + "componentType": "Text", + "name": "FixedValueContents", + "properties": { + "label": { + "value": "Fixed Value" + } + } + }, + { + "componentType": "Button", + "name": "FixedValueMutation", + "events": { + "click": { + "action": "Amplify.Mutation", + "parameters": { + "state": { + "componentName": "FixedValueContents", + "property": "label", + "set": { + "value": "Mutated Value" + } + } + } + } + }, + "properties": { + "children": { + "value": "Mutate" + } + } + } + ] + }, + { + "componentType": "Flex", + "name": "BoundValueInitialBindingSection", + "properties": { + "direction": { + "value": "row" + } + }, + "children": [ + { + "componentType": "Heading", + "name": "BoundValueHeading", + "properties": { + "level": { + "value": 5 + }, + "label": { + "value": "Bound Initial Value" + } + } + }, + { + "componentType": "Text", + "name": "BoundValueContents", + "properties": { + "label": { + "bindingProperties": { + "property": "user", + "field": "lastName" + } + } + } + }, + { + "componentType": "Button", + "name": "BoundValueMutation", + "events": { + "click": { + "action": "Amplify.Mutation", + "parameters": { + "state": { + "componentName": "BoundValueContents", + "property": "label", + "set": { + "value": "Mutated Value" + } + } + } + } + }, + "properties": { + "children": { + "value": "Mutate" + } + } + } + ] + }, + { + "componentType": "Flex", + "name": "ConcatValueInitialBindingSection", + "properties": { + "direction": { + "value": "row" + } + }, + "children": [ + { + "componentType": "Heading", + "name": "ConcatValueHeading", + "properties": { + "level": { + "value": 5 + }, + "label": { + "value": "Concat Initial Value" + } + } + }, + { + "componentType": "Text", + "name": "ConcatValueContents", + "properties": { + "label": { + "concat": [ + { + "value": "Concat" + }, + { + "value": " " + }, + { + "value": "Value" + } + ] + } + } + }, + { + "componentType": "Button", + "name": "ConcatValueMutation", + "events": { + "click": { + "action": "Amplify.Mutation", + "parameters": { + "state": { + "componentName": "ConcatValueContents", + "property": "label", + "set": { + "value": "Mutated Value" + } + } + } + } + }, + "properties": { + "children": { + "value": "Mutate" + } + } + } + ] + }, + { + "componentType": "Flex", + "name": "ConditionalValueInitialBindingSection", + "properties": { + "direction": { + "value": "row" + } + }, + "children": [ + { + "componentType": "Heading", + "name": "ConditionalValueHeading", + "properties": { + "level": { + "value": 5 + }, + "label": { + "value": "Conditional Initial Value" + } + } + }, + { + "componentType": "Text", + "name": "ConditionalValueContents", + "properties": { + "label": { + "condition": { + "property": "user", + "field": "lastName", + "operator": "eq", + "operand": "Bound Value", + "then": { + "value": "Conditional Value" + }, + "else": { + "value": "Unconditional Value" + } + } + } + } + }, + { + "componentType": "Button", + "name": "ConditionalValueMutation", + "events": { + "click": { + "action": "Amplify.Mutation", + "parameters": { + "state": { + "componentName": "ConditionalValueContents", + "property": "label", + "set": { + "value": "Mutated Value" + } + } + } + } + }, + "properties": { + "children": { + "value": "Mutate" + } + } + } + ] + }, + { + "componentType": "Flex", + "name": "AuthValueInitialBindingSection", + "properties": { + "direction": { + "value": "row" + } + }, + "children": [ + { + "componentType": "Heading", + "name": "AuthValueHeading", + "properties": { + "level": { + "value": 5 + }, + "label": { + "value": "Auth Initial Value" + } + } + }, + { + "componentType": "Text", + "name": "AuthValueContents", + "properties": { + "label": { + "userAttribute": "email" + } + } + }, + { + "componentType": "Button", + "name": "AuthValueMutation", + "events": { + "click": { + "action": "Amplify.Mutation", + "parameters": { + "state": { + "componentName": "AuthValueContents", + "property": "label", + "set": { + "value": "Mutated Value" + } + } + } + } + }, + "properties": { + "children": { + "value": "Mutate" + } + } + } + ] + }, + { + "componentType": "Flex", + "name": "StateValueInitialBindingSection", + "properties": { + "direction": { + "value": "row" + } + }, + "children": [ + { + "componentType": "Heading", + "name": "StateValueHeading", + "properties": { + "level": { + "value": 5 + }, + "label": { + "value": "State Initial Value" + } + } + }, + { + "componentType": "Text", + "name": "StateValueContents", + "properties": { + "label": { + "componentName": "StateSource", + "property": "label" + } + } + }, + { + "componentType": "Button", + "name": "StateValueMutation", + "events": { + "click": { + "action": "Amplify.Mutation", + "parameters": { + "state": { + "componentName": "StateValueContents", + "property": "label", + "set": { + "value": "Mutated Value" + } + } + } + } + }, + "properties": { + "children": { + "value": "Mutate" + } + } + }, + { + "componentType": "Text", + "name": "StateSource", + "properties": { + "label": { + "value": "State Value" + } + } + } + ] + } + ], + "schemaVersion": "1.0" +} diff --git a/packages/codegen-ui/lib/utils/index.ts b/packages/codegen-ui/lib/utils/index.ts index 2ada7a51e..b756de5eb 100644 --- a/packages/codegen-ui/lib/utils/index.ts +++ b/packages/codegen-ui/lib/utils/index.ts @@ -15,3 +15,4 @@ */ export * from './component-metadata'; export * from './component-tree'; +export * from './state-reference-metadata'; diff --git a/packages/codegen-ui/lib/utils/state-reference-metadata.ts b/packages/codegen-ui/lib/utils/state-reference-metadata.ts new file mode 100644 index 000000000..c9bb77bbe --- /dev/null +++ b/packages/codegen-ui/lib/utils/state-reference-metadata.ts @@ -0,0 +1,117 @@ +/* + Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"). + You may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +import { StudioComponent, StudioComponentProperty, StateReference } from '../types'; +import { getComponentFromComponentTree } from './component-tree'; + +/** + * TODO: UNIT TESTS ON ME + */ + +export type StateReferenceMetadata = { + stateReference: StateReference; + dataDependencies: string[]; +}; + +/** + * Component Structure Functions + */ + +export function computeStateReferenceMetadata( + component: StudioComponent, + stateReferences: StateReference[], +): StateReferenceMetadata[] { + return dedupeStateReferences(stateReferences).map((stateReference) => { + const dataDependencies = computeDataDependenciesForStateReference(component, stateReference); + return { stateReference, dataDependencies }; + }); +} + +/** + * Utility Functions + */ + +/** + * Dedupes state references by componentName + property, returning a consolidate + * list, stripping the `set` property from them. We do this by serializing to json, + * collecting in a set, then deserializing. + */ +function dedupeStateReferences(stateReferences: StateReference[]): StateReference[] { + const dedupedSerializedRefs = [ + ...new Set( + stateReferences.map((stateReference) => { + const { componentName, property } = stateReference; + return JSON.stringify({ componentName, property }); + }), + ), + ]; + return dedupedSerializedRefs.map((ref) => JSON.parse(ref)); +} + +function reduceDataDependencies(dataDependencies: string[]): string[] { + return [...new Set(dataDependencies)]; +} + +/** + * Property Functions + */ + +function computeDataDependenciesForStudioComponentProperty(property: StudioComponentProperty): string[] { + return reduceDataDependencies( + ([] as string[]) + .concat( + 'concat' in property && property.concat + ? property.concat.flatMap(computeDataDependenciesForStudioComponentProperty) + : [], + ) + .concat('userAttribute' in property && property.userAttribute ? ['authAttributes'] : []) + .concat( + 'bindingProperties' in property && property.bindingProperties ? [property.bindingProperties.property] : [], + ) + .concat('collectionBindingProperties' in property && property.collectionBindingProperties ? ['items'] : []) + .concat( + 'condition' in property && property.condition && 'property' in property.condition && property.condition.property + ? [property.condition.property] + : [], + ) + .concat( + 'condition' in property && property.condition && 'then' in property.condition && property.condition.then + ? computeDataDependenciesForStudioComponentProperty(property.condition.then) + : [], + ) + .concat( + 'condition' in property && property.condition && 'else' in property.condition && property.condition.else + ? computeDataDependenciesForStudioComponentProperty(property.condition.else) + : [], + ), + ); +} + +/** + * State Functions + */ + +function computeDataDependenciesForStateReference( + component: StudioComponent, + stateReference: StateReference, +): string[] { + const { componentName, property } = stateReference; + const namedComponent = getComponentFromComponentTree(component, componentName); + const propertyDefinition = namedComponent.properties[property]; + if (propertyDefinition) { + return computeDataDependenciesForStudioComponentProperty(propertyDefinition); + } + return []; +} diff --git a/packages/test-generator/integration-test-templates/cypress/integration/action-binding-spec.ts b/packages/test-generator/integration-test-templates/cypress/integration/action-binding-spec.ts index f632ab1c0..769c892e8 100644 --- a/packages/test-generator/integration-test-templates/cypress/integration/action-binding-spec.ts +++ b/packages/test-generator/integration-test-templates/cypress/integration/action-binding-spec.ts @@ -105,7 +105,7 @@ describe('Workflow', () => { }); }); - it.skip('supports bound values', () => { + it('supports bound values', () => { cy.get('#bound-value-initial-binding-section').within(() => { cy.contains('Bound Value'); cy.contains('Mutate').click(); @@ -121,7 +121,7 @@ describe('Workflow', () => { }); }); - it.skip('supports conditional values', () => { + it('supports conditional values', () => { cy.get('#conditional-value-initial-binding-section').within(() => { cy.contains('Conditional Value'); cy.contains('Mutate').click(); @@ -129,7 +129,7 @@ describe('Workflow', () => { }); }); - it.skip('supports auth values', () => { + it('supports auth values', () => { cy.get('#auth-value-initial-binding-section').within(() => { cy.contains('Auth Value'); cy.contains('Mutate').click();