wxt-dev / wxt-dev/wxt

[FEAT] support watch meta change in storage

Open
#1,988 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

contribution welcome good first issue
Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Feature Request

Now we only support to watch the value of the local storage. But can't watch the change of the metadata of local storage variable.

What are the alternatives?

Now we have to add $ at the end of the KEY local:someKey$ to watch its metadata. But in the future, the underline implementation of the meta may change, and may should not add $.

This is the work around of my code

  // Add $ to the key to get the meta key for LAST_SYNCED_CONFIG_STORAGE_KEY
  const metaKey = `local:${LAST_SYNCED_CONFIG_STORAGE_KEY}$`

  const unwatch = storage.watch<LastSyncedConfigMeta>(metaKey, (_, newMeta) => {
    const meta = newMeta
    setAtom(meta?.lastSyncedAt ?? null)
  })
Additional context

Add any other context or screenshots about the feature request here.

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 by tracing the storage.watch API and its handling of local storage keys, including the current local:someKey$ metadata convention. Define the metadata-watch behavior without requiring the $ suffix, while preserving existing value watching; done means callers can observe metadata changes through the storage API.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.