I recently dove into a few scenarios where unloadRecord was behaving badly but which seemed as though they should have failed tests. I discovered:
deleteRecord and destroyRecord scenariosdestroyRecord + unloadRecord moves the record to an empty non-deleted, non-destroyed (simply non-loaded) state 馃槺 createRecord scenarios where relationships are involved@fivetanley I suspect this is why our destroyRecord also unloading PR produced failures for you in #5455
Also related: #5006
Hello, I was wondering if this issue is still open? I'm a beginning and would be interested in learning more!
Hi! I tried the latest ember-data version (3.2.0-beta.2) and the problem described here https://github.com/emberjs/data/issues/5328 is still here. I'm stuck in 2.12 because of this.
The scenario is as follow:
1) Receive a bunch of model to delete from a websocket
2) Peek the record with store.peekRecord
3) Unload the record with object.unloadRecord()
After that, I get a bunch of 404, ember data is trying to get the record again.
In 2.12 everything is ok.
@Gabbyjose we're still working on this one, I've added some tests but we're not quite done. Sorry for not getting back to you sooner, last month was a bit... out there. If you'd still like to help I'd love to pair with you!
@Vincz this issue has nothing to do with #5328. unloadRecord isn't for "forgetting" records, it is for marking them as stale (e.g. needs to be reloaded). However, there is a way to delete records which we will codify soon (been working on an RFC). The gist of it is here
@runspired no worries at all - crazy what happened! i'm definitely still happy to take a stab at this and work with you. please let me know what works best for you!
@Gabbyjose awesome to hear! Is there a good time tomorrow to sync for 30 minutes or so? I'm on Pacific Time. You can find me on Slack/Discord/Twitter/Gmail as @runspired if that's easier to chat to set something up.
@runspired Thank you for sharing your code. I tried it and it seems to work just fine :) I'm just worried about relationship without inverse (inverse: null). Will it work ?
I think I have one of the scenarios that is not covered. I am trying to upgrade from 2.18, in which I have good, passing test coverage. I've ruled out a couple of issues (https://github.com/emberjs/data/issues/5517, https://github.com/ember-fastboot/ember-cli-fastboot/issues/223) But have eventually ended up here.
@amk221 if you can describe it, that would be awesome! There are a couple of known outstanding issues / areas of coverage needed, but most of the ones above have been added.
I _think_ there are a couple of things, all demo'd in the above repo.
rels.invoke('unloadRecord'), a second call to myModel.rels _does_ not make a request for data. But after 2.18 it does.The following PRs were created or include tests that address this:
Closing as I think our coverage gap is no longer so severe.
Most helpful comment
Hi! I tried the latest ember-data version (3.2.0-beta.2) and the problem described here https://github.com/emberjs/data/issues/5328 is still here. I'm stuck in 2.12 because of this.
The scenario is as follow:
1) Receive a bunch of model to delete from a websocket
2) Peek the record with store.peekRecord
3) Unload the record with object.unloadRecord()
After that, I get a bunch of 404, ember data is trying to get the record again.
In 2.12 everything is ok.