-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix: only listen for the 'storage' event if using 'local' storage #159
fix: only listen for the 'storage' event if using 'local' storage #159
Conversation
🦋 Changeset detectedLatest commit: f06f259 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Two more things: Unsure if there's anything else required, so I made this a draft PR. The second is that I added the |
Done. Let me know if there are any more pendings. If not, I'll add a changeset and take the PR out of Draft status. |
Feel free to move it out of draft @webJose ! |
Thank you! |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Ha, you were in a hurry. I came but the branch was merged already. |
Fixes #150.
Notes
jsdom doesn't raise the 'storage' event because this event only fires when values change in a different window, which is something we don't have (we only have one window). So to unit-test, one must dispatch the event manually.
Also: The event handler uses
getValueFromStorage
to obtain the value, but theevent.newValue
property already has this value. This seems like an unnecessary performance hit, and may be best to simply deserializeevent.newValue
.New Situation/Issue
I noticed that there is no deletion. I think that whenever
this.#current
becomes undefined, the value in storage should be deleted.