Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression from valpropertymsg directive changes #7690

Conversation

nathanwoulfe
Copy link
Contributor

Fixes regression where validation object doesn't always exist on the property, depending on context - when adding an editor to a content type, the validation logic runs, but the validation property on the editor doesn't exist.

Changes here add an explicit check for currentProperty.validation before trying to access .mandatory

This relates to the changes from #7662 - ping @poornimanayar since she's across those changes 😄

Prerequisites

  • I have added steps to test this contribution in the description below

To test, edit a content type, adding a new property editor, should be no JS errors logged into the console. Validation should clear as expected when editing the property value on a content item.

@nathanwoulfe
Copy link
Contributor Author

Try adding a text box to an existing type, before applying this change - will throw a js error when the editor config overlay opens, because validation isn't a property on the property editor. If there are other places where the property editor model doesn't include the validation object, this fix will manage those too

Copy link
Contributor

@poornimanayar poornimanayar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done spotting it @nathanwoulfe. This totally works, happy to approve. And thanks for adding the extra notes for testing :-)

@poornimanayar poornimanayar merged commit 366b4fc into umbraco:v8/contrib Feb 20, 2020
@poornimanayar
Copy link
Contributor

And merged your work ⭐️ ! Thanks as always :-)

@nathanwoulfe
Copy link
Contributor Author

No worries - happened to have Dev tools open and noticed the error. I don't think it actually broke anything since the model value never changed so was never validated, but still needed to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants