Skip to content

Id map clean-up #17

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

Closed
radarfox opened this issue Dec 12, 2015 · 1 comment
Closed

Id map clean-up #17

radarfox opened this issue Dec 12, 2015 · 1 comment

Comments

@radarfox
Copy link

Hello Jason,

I have found a bug / performance tweak in this adapter. It causes saving unnecessary data in storage.

Conditions:

  • create new empty resource with this adapter
  • call find or findAll or destroyAll

OR

  • have a last item in resource
  • call destroy on in

Result:

Unnecessary id map for resource with value {} is created in localstorage.

I dont like it because:

  • it is slowing down my app initialization (async create for each resource)
  • it is lowering my localstorage data limit, especially when using longer endpoint/resource name
  • it is making debug harder because of long list of localstorage data, so I have to scroll and look what "real" data are stored

I think that the problem is in this line https://github.com/js-data/js-data-localstorage/blob/master/dist/js-data-localstorage.js#L159

@radarfox
Copy link
Author

Works like a charm. Thanks much for the quick fix.

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

1 participant