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

Do not validate element during toggle fold and create #2186

Merged
merged 2 commits into from
Sep 2, 2021

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Aug 28, 2021

What is this pull request for?

Elements with ingredient validations might get invalid on update. Since we do not care about the validations during toggling a UI state we skip them.

If an element has ingredient validations creating it first and calling valid? after that triggers the on update validation callback. Resulting in returning the new template instead.

Solved by only building the element and saving it later. This does not trigger the on update callback.
To spare an extra save we set the elements position instead of moving it down.
The only unnecessary ave we could not prevent is if we paste from clipboard.
But this is acceptable.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

Elements with ingredient validations might get invalid on update.
Since we do not care about the validations during toggling a UI
state we skip them.
@tvdeyen tvdeyen added this to the 6.0 milestone Aug 28, 2021
@tvdeyen tvdeyen requested a review from a team August 28, 2021 16:11
If an element has ingredient validations
careating it first and calling valid? after that triggers the on update
validation callback. Resulting in returning the new template instead.

Solved by only building the element and saving it later. This does not trigger the on update callback.
To spare an extra save we set the elements position instead of moving it down.
The only unnecessary ave we could not prevent is if we paste from clipboard.
But this is acceptable.
@tvdeyen tvdeyen changed the title Do not validate element during toggle fold Do not validate element during toggle fold and create Aug 28, 2021
Copy link
Contributor

@mamhoff mamhoff left a comment

Choose a reason for hiding this comment

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

One less save!

@tvdeyen tvdeyen merged commit a9811b4 into AlchemyCMS:main Sep 2, 2021
@tvdeyen tvdeyen deleted the skip-validations-on-element-toggle branch September 2, 2021 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants