Skip to content

Validation of HiddenProperty References #536

@bkobus

Description

@bkobus

Is your feature request related to a problem? Please describe.
When using the Dynamic UI: Hidden Property feature the developer must provide a reference to another property either within the same object or another object. If the 'path' to that object isn't specified correctly there is no error raised during dvp build, or upload. Even during rendering the UI the user will only see things incorrectly displayed, or not displayed at all. The browsers developer tools might provide more information, but may be difficult for even developers to diagnose.

For example if the linked_source_definition contains something like:
"dxFormProperties": { "hideExpression": "field.parent.foo.bar === 'blah blah blah'" },
The developer might see the dsource linking wizard improperly render the display and if they knew enough to check developer tools they would see an exception like:
TypeError: Cannot read properties of undefined (reading 'bar') at eval (eval at <anonymous> (ngx-formly-core.mjs:1540:1), <anonymous>:3:25) at exprValue.field (ngx-formly-core.mjs:1651:1) at ngx-formly-core.mjs:1548:1 at Object.callback (ngx-formly-core.mjs:1651:1) at FieldExpressionExtension.checkExpressions (ngx-formly-core.mjs:1678:1) at ngx-formly-core.mjs:1681:1 at Array.forEach (<anonymous>) at FieldExpressionExtension.checkExpressions (ngx-formly-core.mjs:1681:1) at ngx-formly-core.mjs:1681:1 at Array.forEach (<anonymous>)
However, on the summary page they might also see a more cryptic exception like:
ReferenceError: field is not defined at ShrDynamicSchemaViewer.eval (eval at value (shr-dynamic-schema-viewer.js:162:28), <anonymous>:3:1) at ShrDynamicSchemaViewer.value (shr-dynamic-schema-viewer.js:153:31) at ShrDynamicSchemaViewer.value (shr-dynamic-schema-viewer.js:142:21) at shr-dynamic-schema-viewer.js:130:22 at Array.map (<anonymous>) at ShrDynamicSchemaViewer.value (shr-dynamic-schema-viewer.js:129:19) at shr-dynamic-schema-viewer.js:48:34 at Object.checkAndSubscribe (system.js:195:21) at Object.checkAndSubscribe (ko-manager.js:113:25) at shr-dynamic-schema-viewer.js:46:30 'Possibly unhandled rejection: {}'

Describe the solution you'd like
It would be nice if we could 'validate' the references during dvp build. I suspect that to be over complex if the customer provides a more complex conditional. I'm not sure if another alternative would be possible once the plugin is uploaded.

Describe alternatives you've considered
At a mninimum, I think the developer docs for the Hidden Property should caution developers they may need to look at the developer tools for additional information if they experience issues with rendering of these UI components.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions