Skip to content

refactor: Code cleanup for storage package#2085

Merged
aklinker1 merged 2 commits intomainfrom
storage-cleanup
Feb 9, 2026
Merged

refactor: Code cleanup for storage package#2085
aklinker1 merged 2 commits intomainfrom
storage-cleanup

Conversation

@aklinker1
Copy link
Member

Overview

Broken out of #2081.

The storage code was originally very small and I tried to keep it small as it grew... So this PR adds a lot of whitespace I would normally add back to the code.

Manual Testing

CI passes

@netlify
Copy link

netlify bot commented Feb 8, 2026

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 72ff2a0
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6988cdfdf8d5ab0008fd6989
😎 Deploy Preview https://deploy-preview-2085--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 project configuration.

}
const migrate = async () => {

const migrate: WxtStorageItem<any, any>['migrate'] = async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

TS performance change, fully typing the function instead of having to look at the implementation.

Comment on lines -383 to +431
if (debug === true) {
if (debug) {
Copy link
Member Author

@aklinker1 aklinker1 Feb 8, 2026

Choose a reason for hiding this comment

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

Unnecessarily strict check

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 8, 2026

Open in StackBlitz

@wxt-dev/analytics

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

@wxt-dev/auto-icons

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

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@2085

@wxt-dev/i18n

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

@wxt-dev/module-react

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

@wxt-dev/module-solid

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

@wxt-dev/module-svelte

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

@wxt-dev/module-vue

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

@wxt-dev/runner

npm i https://pkg.pr.new/@wxt-dev/runner@2085

@wxt-dev/storage

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

@wxt-dev/unocss

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

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@2085

wxt

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

commit: 72ff2a0

Comment on lines +564 to +568
throw Error(`'wxt/storage' must be loaded in a web extension environment

- If thrown during a build, see https://github.com/wxt-dev/wxt/issues/371
- If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/go-further/testing.html
`);
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to join an array, just define the string in a readable way.

@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.93%. Comparing base (1fe0730) to head (72ff2a0).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2085      +/-   ##
==========================================
- Coverage   76.03%   75.93%   -0.10%     
==========================================
  Files         113      113              
  Lines        3050     3050              
  Branches      686      686              
==========================================
- Hits         2319     2316       -3     
- Misses        648      650       +2     
- Partials       83       84       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

if (change == null) return;
if (dequal(change.newValue, change.oldValue)) return;

if (change == null || dequal(change.newValue, change.oldValue)) return;
Copy link
Member Author

Choose a reason for hiding this comment

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

Combined to a single statement.

@aklinker1 aklinker1 self-assigned this Feb 8, 2026
Co-Authored-By: Patryk Kuniczak <p.kuniczak@gmail.com>
@aklinker1 aklinker1 marked this pull request as ready for review February 8, 2026 17:55
@aklinker1 aklinker1 requested a review from Timeraa as a code owner February 8, 2026 17:55
@aklinker1 aklinker1 merged commit a63c320 into main Feb 9, 2026
18 checks passed
@aklinker1 aklinker1 deleted the storage-cleanup branch February 9, 2026 07:36
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Thanks for helping make WXT better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants