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

Setting a relationship to null does not allow it to be set to any other value afterwards #643

Open
vicjavariz opened this issue Feb 23, 2022 · 7 comments

Comments

@vicjavariz
Copy link

vicjavariz commented Feb 23, 2022

Version

v3.15.0

Expected Behavior

When setting a relationship to null, you should then be able to set it back to another value.

Actual Behavior

When setting a relationship to null, you are not able to set its value to anything else and it remains set to null.

Steps to reproduce

this.changeset.relationship = this.store.peekRecord('relationship', id); // value is set to the found record.
this.changeset.relationship = null; // value is set to null.
this.changeset.relationship = this.store.peekRecord('relationship', id); // value continues to be set to null
@dxmo
Copy link

dxmo commented Mar 2, 2022

@fonsovariz I came across the same issue. Seems this has to do with some conditional logic inside 'validated-changeset'. Anyway I was able to workaround this by setting the value to 'undefined' instead of 'null'. See if that helps.

@snewcomer
Copy link
Collaborator

Seems like an easy PR if you want to take it!

@dxmo
Copy link

dxmo commented Mar 2, 2022

@snewcomer yup - let me give it a try ;)

@dxmo
Copy link

dxmo commented Mar 3, 2022

@snewcomer this pull request fixes it for me:

#adopted-ember-addons/validated-changeset#163

@dxmo
Copy link

dxmo commented Mar 10, 2022

@snewcomer just a quick update - the issue disappeared the moment we upgraded our app to ember 3.28. I guess this issue can be closed

@snewcomer
Copy link
Collaborator

I'll leave it to @fonsovariz confirm. But missing null is a common bug. So I would assume there might be something other than an upgrade.

@vicjavariz
Copy link
Author

1 Year Later
It works. 👍

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

No branches or pull requests

3 participants