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

Id map name #18

Open
radarfox opened this issue Dec 12, 2015 · 2 comments
Open

Id map name #18

radarfox opened this issue Dec 12, 2015 · 2 comments

Comments

@radarfox
Copy link

Hello Jason,

I have found a bug in this adapter. Under some extreme condtions it can probably cause two resources to read from one localstorage.

Conditions:

DSLocalStorageAdapterProvider.defaults.basePath = 'base';
DS.defineResource({endpoint: 'endpoint', name: 'name'});
DS.create('name', {}, {adapter: 'localstorage'});

Result:

Store contains:

{
  "base/name": "{'123': 1}",
  "base/endpoint/123": "{}",
}

Why is the localstorage key different?

@jmdobry
Copy link
Member

jmdobry commented Dec 12, 2015

I think there's more code that you're not showing, where did the 123 come from?

@radarfox
Copy link
Author

123 is unique id which is assigned by adapter during create.

My code is of course much more complicated, but i was trying to reduce complexity for you.

I think the root of problem is custom endpoint. Without it the localstorage keys are good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants