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

store.unloadAll does not reset meta data #2772

Closed
runspired opened this issue Feb 10, 2015 · 4 comments
Closed

store.unloadAll does not reset meta data #2772

runspired opened this issue Feb 10, 2015 · 4 comments

Comments

@runspired
Copy link
Contributor

Using ember-cli, given type conversation-preview, after calling this.get('store').unloadAll('conversationPreview') a call to this.get('store').metadataFor('conversation-preview'); returns the stale meta data.

@bmac
Copy link
Member

bmac commented Feb 10, 2015

Seems like a reasonable change. @runspired would you like to submit a pr for this behavior?

@runspired
Copy link
Contributor Author

I should be able to put one together, but I may need some additional info.

When trying to fix this locally within my app:

var store = this.get('store');
store.metadataFor('conversation-preview');
//{"total":10,"per_page":25,"current_page":1,"last_page":1,"from":1,"to":10}

store.typeMapFor.call(store, 'conversation-preview').metadata;
//{}

store.unloadAll('conversation-preview');

store.metadataFor('conversation-preview');
//{"total":10,"per_page":25,"current_page":1,"last_page":1,"from":1,"to":10}

store.typeMapFor.call(store, 'conversation-preview').metadata;
//{}

I would think these would return the same thing based on: https://github.com/emberjs/data/blob/v1.0.0-beta.14.1/packages/ember-data/lib/system/store.js#L1081-L1084

@bmac
Copy link
Member

bmac commented Feb 10, 2015

I think your demo example is missing this line where the store uses the first argument to get the Model class for 'conversation-preview' and uses that as the key for typeMapFor.

@runspired
Copy link
Contributor Author

Thanks, that was all it was.

@igorT igorT closed this as completed in a7dd2d3 Mar 31, 2015
igorT added a commit that referenced this issue Mar 31, 2015
Clear meta data when unloading all records for a type. Fixes #2772
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants