wxt-dev / wxt-dev/wxt

Get Value does not return the latest value

Open
#1,766 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

I have this code:

// utils/storage.ts
const list = storage.defineItem<string[]>(
  'local:list',
  {
    fallback: [],
  },
);

export const store = {
  list,
};

Somewhere in the onClick event button:

await store.list.removeValue();
const value = 'test';
let list = await store.list.getValue();
console.log(list);
list.push(value);
await store.list.setValue(list);

The console log:

[]
['test']
(2) ['test', 'test']
(3) ['test', 'test', 'test']

I expect to get this:

[]
[]
[]
Reproduction

wxt-example.zip

Steps to reproduce

No response

System Info
System:
    OS: macOS 15.4.1
    CPU: (14) arm64 Apple M4 Pro
    Memory: 754.11 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.16.0 - ~/.nvm/versions/node/v22.16.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.16.0/bin/npm
    pnpm: 10.10.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 137.0.7151.120
    Safari: 18.4
  npmPackages:
    wxt: ^0.20.6 => 0.20.7
Used Package Manager

npm

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached wxt-example.zip and the storage definition in utils/storage.ts. Run the reproduction and trace the removeValue, getValue, and setValue calls from the onClick handler. Done means repeated clicks no longer accumulate prior list values and the observed output matches the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.