Repository navigation
Conversation
The storage event listener passed `ev.key` to the watch callback as is. With `base` set, every key came back with the base still on it, and writes to unrelated localStorage keys were reported as changes. Resolves unjs#853
|
@mufasil is attempting to deploy a commit to the unjs Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Closing this as a duplicate of #854, which fixes the same thing and was opened first. Sorry, I missed it when I checked. |
Resolves #853
With
baseset, thestorageevent listener passedev.keystraight to the watch callback. A watcher onlocalStorageDriver({ base: "app" })gotapp:user:1instead ofuser:1, so the key didn't match whatgetItemandgetKeysuse, and writes to localStorage keys outsidebasewere reported as changes too.session-storagereuses this driver, so it gets the same fix.The listener now skips keys that don't start with
${base}:and strips the base from the rest, the same waygetKeysdoes.On the tests, the existing watch tests dispatched keys without the base and expected them back unchanged, which matched the bug. They now dispatch
test:s1:random_fileand expects1:random_file. A new test checks that__external_key__andtesting:s1:a(same prefix, no separator) aren't reported.Summary by CodeRabbit