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

Failing test case for validating computed property #482

Merged

Conversation

andreyfel
Copy link
Contributor

@andreyfel andreyfel commented May 18, 2020

Not sure if it is supposed to work, but this PR illustrates the issue.

The use case is the following:
I want to be able to validate derived state, not the root state.
So, model contains a bunch of changes, but the condition of validity
is defined based on several changes.

With the regular approach when changes are applied to a model, I can
define a computed property (or a getter) and validate against it.

With the changeset approach, model's computed property won't be updated
because the model itself is not changed. So, the idea is to define a
computed property on the Changeset level. But it isn't even evaluated.

Illustrates #474

The use case is the following:
I want to be able to validate derived state, not the root state.
So, model contains a bunch of changes, but the condition of validity
is defined based on several changes.

With the regular approach when changes are applied to a model, I can
define a computed property (or a getter) and validate against it.

With the changeset approach, model's computed property won't be updated
because the model itself is not changed. So, the idea is to define a
computed property on the Changeset level. But it isn't even evaluated.

This case has been supported in validated-changeset.
This PR adds a test on the ember-changeset level.
@andreyfel andreyfel force-pushed the validate-computed-property branch from 04b201c to 0f9e301 Compare May 28, 2020 08:01
The issue which this PR illustrates was fixed in
validated-changeset@0.5.11
Copy link
Collaborator

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

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

Awesome!! Thank you!

@snewcomer snewcomer merged commit eb1bbc7 into adopted-ember-addons:master May 28, 2020
@andreyfel andreyfel deleted the validate-computed-property branch May 29, 2020 16:22
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