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

[BUGFIX] resolve issues with RecordArray sync for peekAll #5378

Merged
merged 6 commits into from Mar 26, 2018

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Mar 15, 2018

This PR resolves issues with ensuring that RecordArray is correctly synced for peekAll.

Resolves #5271
Resolves #5167
Resolves #5175
Resolves #5111 / #5157

It also includes tests and a fix for #5350 and #5025 / #5095 wherein non-materialized records would remain in live-record-arrays and filtered record arrays upon unload.

Resolves #5025

cc @tylerturdenpants @igorT @hjdivad @workmanw

@tylerturdenpants
Copy link
Member

@runspired, it works so far! I'll check back in when I get more coverage of my app

@HeroicEric
Copy link
Sponsor Member

HeroicEric commented Mar 18, 2018

I tested this with our app that has been stuck at Ember Data 2.13.2 for a while and this lets us go all the way to 3.x 😄

@sly7-7
Copy link
Contributor

sly7-7 commented Mar 19, 2018

I really have to dig and try to narrow my problem then, I still encounter a

ember-console.js:29 TypeError: Cannot read property 'eachAttribute' of null
    at new Snapshot (-private.js:5377)
    at InternalModel.createSnapshot (-private.js:7173)
    at _findHasMany (-private.js:9104)
    at Class.findHasMany (-private.js:11343)
    at ManyRelationship.fetchLink (-private.js:4871)
    at ManyRelationship.findLink (-private.js:4132)
    at ManyRelationship.getRecords (-private.js:4913)
    at Class.get (-private.js:13357)
    at ComputedPropertyPrototype.get (ember-metal.js:4064)
    at get (ember-metal.js:3436)

In my scenario, there are several unloadAll calls and a route.refresh call, whereas models are still displayed on the screen.

@runspired
Copy link
Contributor Author

@sly7-7 hrm :/ Makes me suspicious that #5376 has not caught everything it needed to.

@tylerturdenpants
Copy link
Member

@sly7-7 I had the same issue way back in 2.13. I think I resolved it by routing away from where the models were in use and then performed the unload.

As an aside, @runspired, what will it take to get this merged? This has been the most promising fix in the last few months. I owe you big time. You’re a huge value to this community.

@btecu
Copy link
Contributor

btecu commented Mar 20, 2018

Will this make it into 3.1?

@sly7-7
Copy link
Contributor

sly7-7 commented Mar 21, 2018

@tylerturdenpants
@sly7-7 I had the same issue way back in 2.13. I think I resolved it by routing away from where the models were in use and then performed the unload.

Thank you for the tip, I will see if I can try that as a workaround, but for sure there is 'something' wrong 'somewhere'

@runspired
Copy link
Contributor Author

@sly7-7 I have some thoughts on what your bug is, will try to write a test to see if it fails.

@Kilowhisky
Copy link

Kilowhisky commented Mar 27, 2018

Found a related issue: #5395 #bummer

@tylerturdenpants
Copy link
Member

@bmac In what version is this slated to land?

@sly7-7
Copy link
Contributor

sly7-7 commented Mar 27, 2018

@tylerturdenpants It should be in the just released 3.1. You will encounter a warning though: #5372 (comment) but as @bmac said patch will be soon released too 😄

@tylerturdenpants
Copy link
Member

Oh nice @sly7-7. Wish you luck on your issues. I’m still encountering the “Id already used” but is much easier to patch.

@bmac
Copy link
Member

bmac commented Mar 27, 2018

Since this was just merged I didn't cherry pick it into 3.1 just yet. Currently its only on 3.2.0-beta.1 but I'd be willing to make a patch release to 3.1 in a few days if nothing major gets reported on the beta release.

@runspired runspired deleted the fix-peek-all branch March 27, 2018 18:03
svenpl pushed a commit to liemak-it/data that referenced this pull request Mar 28, 2018
@omairvaiyani
Copy link

Unfortunately I'm still receiving the error:
Ember Data 3.2.0-beta.1
"Assertion Failed: Cannot create a new chain watcher for `<.. model .. >` after it has been destroyed."

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