-
-
Notifications
You must be signed in to change notification settings - Fork 466
Closed
Copy link
Description
Describe the bug
Given that there's an item definition with migrations (https://wxt.dev/storage), for example
const item = storage.defineItem<{
value: string;
}>('local:data', {
version: 2,
migrations: {
2: () => {
// some code
},
},
});
Assume that user installed extension for the first time (i.e. there's no version 1 in their storage).
Setting any value to this item will store it without version metadata, which will lead to migration run when refreshing the page (if e.g. it's accessed in some content script).
This is usually incorrect cause migration code assumes data has old format, which never existed and was never set for a fresh install.
Reproduction
A PR with a failing test case: #1774
Steps to reproduce
No response
System Info
System:
OS: Windows 11 10.0.26100
CPU: (16) x64 Intel(R) Core(TM) i7-10700KF CPU @ 3.80GHz
Memory: 34.40 GB / 63.87 GB
Binaries:
Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
npm: 11.4.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.1.4 - C:\Program Files\nodejs\pnpm.CMD
Browsers:
Edge: Chromium (133.0.3065.82)
Internet Explorer: 11.0.26100.1882Used Package Manager
npm
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels