-
Notifications
You must be signed in to change notification settings - Fork 35
feat(with-storage-sync): indexeddb support #134
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
feat(with-storage-sync): indexeddb support #134
Conversation
@rainerhahnekamp |
@audhit |
Hey @mzkmnk looks promising. This is exactly what I am looking for. NGRX tool will be complete with this feature to be honest. @rainerhahnekamp please verify and merge it soon if possible and let us know about the new release. Thanks a lot for the great work guys 🙏 |
1fb0d88
to
843c38f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good work!
I think my biggest suggestion would be this refactoring to withIndexedDB
and withLocalStorage()
.
Other than that, please make sure that the Git History is kept intact (I've added a comment about it).
If there is something unclear, please let me know. I have now a good overview and should be able to respond promptly.
libs/ngrx-toolkit/src/lib/storage-sync/tests/with-storage-sync.spec.ts
Outdated
Show resolved
Hide resolved
@mzkmnk an additional explanation, via it should be With the current implementation, we have the |
BREAKING CHANGE: The storage argument has been renamed to storageType, and its value must now be one of the following strings: 'localStorage', 'sessionStorage', or 'IndexedDB'. Additionally, when 'IndexedDB' is specified, two new arguments, `storeName` and `dbName`, have been added.
f73afeb
to
8189b66
Compare
@rainerhahnekamp |
Regarding this topic, I’ve created a demo here, so please give it a try: The cause of the error is that, in IndexedDB, you have to increase the database version when creating a new object store in an existing database. Because of this, if the library were to fix the version internally, we would need to handle version management ourselves, which would make things more complex. For that reason, I’m currently using the same name for both the storeName and the dbName. I’ve found a better approach than the current one, so I’d like to share it. By fixing the dbName and storeName, and using the IndexedDB keyPath as the key, multiple pieces of data can be stored in a single database. I’ve rebuilt the implementation using this method: |
…exedDB keyPath as the key
…nd withIndexedDb Promise(wip)
@rainerhahnekamp looks good to me, can you please kindly test @mzkmnk's solution and let us know if you can merge and release it? It would be a great help in my project. Thanks in advance 🙏 |
@audhit, we are in the middle of the second set of change requests. We can't merge now. |
So we are saying we are using the same |
… based and withIndexedDb Promise(wip)" This reverts commit d1abdab.
This one has already been corrected.Please check. |
…hronous function
Waiting for it eagerly 🚀 , please kindly make it happen soon if possible 🚀 @rainerhahnekamp .... thanks a lot in advance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mzkmnk I think we should get that issue with git history sorted out and then merge it.
As I said in a comment before. Maybe it is better to move the with-storage-sync.(spec).ts files back where they were and we'll try to do the "git mv" in a separate branch.
I understand. I will move with-storage-sync.(spec).ts back to its original location. Also, regarding c041a49, since it's not really a good fix, would it be okay to revert the changes? |
I would leave everything as it is, so no reverting. The only thing is really about keeping the git history intact. That should do it. |
I've completed moving the with-storage-sync.(spec).ts file. |
Wonderful @mzkmnk. I'm going to squash and merge it. Congratulations! |
@mzkmnk do you want to create the PR which just moves with-storage-sync.*.ts files or should I do that? |
After this PR is merged, I’ll create a PR to move the with-storage-sync.(spec).ts files. |
wowowow...great work guys...now new release and documentation update needs to be done...its soo great and good feeling when someone's request is taken care of. I am so thankful to you guys @mzkmnk and @rainerhahnekamp ... Thank you so much, waiting for it to be released...thanks again :) |
Full kudos ot @mzkmnk |
@rainerhahnekamp |
Issue
#111
Content
In this PR, we modified
withStorageSync
to support IndexedDB.Breaking Changes
withIndexeddb()
,withLocalStorage()
, orwithSessionStorage()
. By default,withLocalStorage()
is used.Sample Code