Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Return early if no migration is needed #1502

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

RayGuo-ergou
Copy link
Contributor

Overview

One thing I noticed is that the migration will run regardless of if the current version is the desired version, e.g. if the current version is 2 and the target version is also 2 I can still see the debug message in console like

@wxt-dev/storage] Running storage migration for local:settings: v2 -> v2 background.js:652:19
[@wxt-dev/storage] Storage migration completed for local:settings v2 

I don't think there's any reason to not return early if the version matches, as the array below will have zero element anyway.

        const migrationsToRun = Array.from(
          { length: targetVersion - currentVersion },
          (_, i) => currentVersion + i + 1,
        );

Copy link

netlify bot commented Mar 5, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 33908b8
🔍 Latest deploy log https://app.netlify.com/sites/creative-fairy-df92c4/deploys/67c7c5a87d905800080641f4
😎 Deploy Preview https://deploy-preview-1502--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good change!

Copy link

pkg-pr-new bot commented Mar 5, 2025

Open in Stackblitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@1502

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@1502

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@1502

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@1502

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@1502

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@1502

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@1502

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@1502

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@1502

wxt

npm i https://pkg.pr.new/wxt@1502

commit: 33908b8

@aklinker1 aklinker1 changed the title feat(storage): return early if no migration is needed fix: Return early if no migration is needed Mar 5, 2025
@aklinker1 aklinker1 merged commit 4704027 into wxt-dev:main Mar 5, 2025
17 checks passed
Copy link
Contributor

github-actions bot commented Mar 5, 2025

Thanks for helping make WXT better!

@aklinker1
Copy link
Collaborator

Released in @wxt/storage@1.1.1

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants