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

Add test for changesetKeys to helper #525

Merged
merged 3 commits into from
Aug 11, 2020
Merged

Conversation

snewcomer
Copy link
Collaborator

ref #523

@csprocket777 👋. I'm familiar with the problem you are having. I haven't come up with a good solution for outside factors attaching state to changesets (including opening Ember inspector). How does this passing test compare to your setup?

@snewcomer snewcomer self-assigned this Aug 7, 2020
@csprocket777
Copy link

I think this represents my use-case right now. If i'm reading the test correctly, you'll find that it's immediately going to be isDirty=true once it hits the DOM (before any action taken to modify the record). Are you seeing the same or similar as I am with that test?

@csprocket777
Copy link

csprocket777 commented Aug 7, 2020

It doesn't seem to matter how I instantiate my changeset, whether it be from the template or from JS.

Currently doing:
Changeset(project, null, null, { changesetKeys: ['projectName', 'engagement', 'collectionPeriod', 'owner', 'proxyUsers', 'teams'] })

And getting the same issue.

@csprocket777
Copy link

csprocket777 commented Aug 7, 2020

Ok. so if I remove the relationship keys from the changesetKeys, things operate as expected...

...sigh... this is not what I want either...

I've traced my problem down to an interaction between ember-changeset and ember-power-select

@snewcomer
Copy link
Collaborator Author

@csprocket777 I'm wondering what the results are here. Is validationKeys and userChangesetKeys what you expect?

https://github.com/validated-changeset/validated-changeset/blob/1d0e3ceb284a61e93633132865f86641c0968ebe/src/index.ts#L242

@csprocket777
Copy link

csprocket777 commented Aug 7, 2020

What I end up seeing here is:

userChangesetKeys:

[
    "projectName",
    "collectionPeriod",
    "owner",
    "proxyUsers",
    "engagement"
]

and validationKeys:

[
    "engagement"
]

I think engagement is appearing in the validationKeys array because ember-power-select is affecting it somehow. That seems to be the pattern right now at least.

@csprocket777
Copy link

I have an example dummy app that represents the issue I'm currently facing:
https://github.com/csprocket777/changeset-powerselect-test-case

@snewcomer snewcomer merged commit ec303c3 into master Aug 11, 2020
@snewcomer snewcomer deleted the sn/changeset-keys-test branch August 11, 2020 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants