[BUG?] UnloadAll cause fetching fail

Hi all,

I find something strange when I try to cleanup data store.

Currently I’m trying to unload all record of specific model type from data store with UnloadAll. Everything work fine unless user try to edit the unloaded record again. Changes can be submitted to server, but when data store try to update model it throw following exception.

Assertion Failed: You cannot set an index for an internalModel that is not in the InternalModelMap

This only happen when I call DS.Store.unloadAll I have tried with DS.Store.unloadRecord and DS.Model.unloadRecord Both of them would not have this issue. Also if I reload record with DS.Store.findRecord with { reload: true }, it also work fine.

Any clue?

Ember version: "2.14.1" Ember Data version: “2.14.10”

I just encountered the same issue. @SelokYeung did you find a solution to this problem?

EDIT: I just gave it a try:

version 1: this does not work:

 [ // let's remove things which depend on content language from memory cache
        'catalog',
        'tag',
        'item'
    ].forEach((modelName) => {
        this.store.unloadAll(modelName);
    });

version 2: this works:

        [ // let's remove things which depend on content language from memory cache
        'catalog',
        'tag',
        'item'
    ].forEach((modelName) => {
        let data = this.store.peekAll(modelName);
        data.forEach((entry) => entry.unloadRecord());
    });

With version 2 everything works as expected but version 1 breaks with the error mentioned above.

Assertion Failed: You cannot set an index for an internalModel that is not in the InternalModelMap

We use the following setup:

Ember: 3.8.1
Ember CLI: 3.9.0
Ember Data: 3.10.0

1 Like