Skip to content

Unwrap value in indexedDb? #67

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
cyrilletuzi opened this issue Jan 3, 2019 · 3 comments
Closed

Unwrap value in indexedDb? #67

cyrilletuzi opened this issue Jan 3, 2019 · 3 comments
Assignees

Comments

@cyrilletuzi
Copy link
Owner

cyrilletuzi commented Jan 3, 2019

Follow up of #65.

Currently, when storing in indexedDb, values are wrapped in this structure: { value: ... }. It's totally OK inside the lib, but can cause (rare) interoperability issues.

Need investigation to check if unwrapping is possible, as it could lead to major breaking change.

@Ruluk
Copy link

Ruluk commented Jan 3, 2019

So, to follow up from #65, what if you consider the object with ONLY the value key as a candidate to unwrap? If it has any other key, it is probably a raw object.

In fact, you could do the opposite and start saving a new key to indicate that you were the one that saved it. So, say, if the key angularAsyncLocalStorage: true exists, then it was surely this lib. Otherwise, fall back to analysis of current data.

Another idea (that may work alongside the previous one) can be to add a configuration option for your lib to indicate a predefined getItem behavior. Possible values could be, e.g, 'always_raw', 'always_unwrap', 'default'.

@cyrilletuzi
Copy link
Owner Author

Your first solution would still be a problem for objects with just value (which is a common pattern).

The last idea will probably be the good one.

@cyrilletuzi cyrilletuzi changed the title Unwrap value in indexedDb for better interoperability Better interoperability: unwrap value in indexedDb Jan 4, 2019
@cyrilletuzi cyrilletuzi added this to the v8.0 milestone Jan 4, 2019
@cyrilletuzi cyrilletuzi changed the title Better interoperability: unwrap value in indexedDb Unwrap value in indexedDb? Jan 4, 2019
@cyrilletuzi
Copy link
Owner Author

Fixed by #82, which will be available in v8.

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