Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4836

If not unloadAll or unloadRecord, what can I do/use?

$
0
0

@melriffe wrote:

Sorry for the click-bait title but I’m not sure how else to frame my question/request.

First: I’m using: ember-cli: 2.18.2 calling a Rails JSONAPI-compliant backend. This project is generally a rewrite of the frontend. The backend process have not been altered but to comply with a JSONAPI Responses. Rewriting those processes is out of scope, completely.

Second: I’m struggling a bit and I was wondering if folks could lend a hand, or some guidance/advice. I think I’m struggling with Ember Data’s “stickiness” (my term).

We have a process that creates and destroys database records in the backend. These records are requested for display and processing. This is done by requesting this process be run via a user-initiated action (i.e. they click a button). After the user has processed this data, making adjustments, if you will, they can request this process be run again.

Like I mentioned: the backend process destroys the previously created records, creates new ones, and returns the new records.

I now have old models in the store that are getting counted when they shouldn’t.

I’ve tried using unloadAll('<type>') and unloadRecord() because I’m trying to get the old models out of the store. However, there is a fetch involved and for the old records they are indeed gone; a 404 is returned, rightfully.

If I’m on the wrong path, please let me know with some gentle redirection. What should/could I be doing instead?

Ideally, here’s what I would like to happen: Just before the process is requested I remove the old models from the store, request the process, and then load up the new models.

I can try to provide additional details if requested. Suffice it to say, I’m banging my head against the wall here.

Thank you for your time.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4836

Trending Articles