Skip to content

fix(extension): resync detected language on tab visibility#1282

Open
frogGuaGuaGuaGua wants to merge 1 commit intomainfrom
fix/1281-tab-detected-code
Open

fix(extension): resync detected language on tab visibility#1282
frogGuaGuaGuaGua wants to merge 1 commit intomainfrom
fix/1281-tab-detected-code

Conversation

@frogGuaGuaGuaGua
Copy link
Copy Markdown
Collaborator

@frogGuaGuaGuaGua frogGuaGuaGuaGua commented Apr 4, 2026

Summary

  • keep each tab's last detected source language in memory inside the content script
  • only sync detectedCode into shared storage when the tab becomes visible again
  • prevent background tabs from overwriting the active tab's detected language state

Fixes #1281.

Testing

  • pnpm exec wxt prepare
  • pnpm exec eslint src/entrypoints/host.content/runtime.ts
  • pnpm exec tsc --noEmit (currently fails in this checkout because of pre-existing unrelated type errors around Notebase / API contract types)

Summary by cubic

Resync detected language only when a tab is visible and keep a per-tab last value in memory. Prevents background tabs from overwriting the active tab’s detected language, fixing #1281.

  • Bug Fixes
    • Defer writes to local:${DETECTED_CODE_STORAGE_KEY} unless document.visibilityState === "visible".
    • Resync stored value on visibilitychange when the tab becomes visible; initialize with DEFAULT_DETECTED_CODE.
    • Replace direct writes on initial load and URL changes with a syncDetectedCodeToStorage helper and clean up the visibility listener on teardown.

Written for commit 7cdd2eb. Summary will update on new commits.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 4, 2026

⚠️ No Changeset found

Latest commit: 7cdd2eb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 4, 2026
@github-actions github-actions bot added the fix label Apr 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Contributor trust score

40/100 — Moderate

This score estimates contributor familiarity with mengxi-ream/read-frog using public GitHub signals. It is advisory only and does not block merges automatically.

Outcome

Score breakdown

Dimension Score Signals
Repo familiarity 21/35 commits in repo, merged PRs, reviews
Community standing 11/25 account age, followers, repo role
OSS influence 0/20 stars on owned non-fork repositories
PR track record 8/20 merge rate across resolved PRs in this repo

Signals used

  • Repo commits: 6 (author commits reachable from the repository default branch)
  • Repo PR history: merged 6, open 3, closed-unmerged 9
  • Repo reviews: 0
  • PR changed lines: 28 (+25 / -3)
  • Repo permission: write
  • Followers: 1
  • Account age: 0 months
  • Owned non-fork repos considered: max 0, total 0 (none)

Policy

  • Low-score review threshold: < 30
  • Auto-close: score < 20 and changed lines > 1000
  • Policy version: v1.1

Updated automatically when the PR changes or when a maintainer reruns the workflow.

@github-actions github-actions bot added the contrib-trust:moderate PR author trust score is 30-59. label Apr 4, 2026
@dosubot dosubot bot added the app: browser extension Related to browser extension label Apr 4, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

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

Labels

app: browser extension Related to browser extension contrib-trust:moderate PR author trust score is 30-59. fix size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 多标签页切换时,源语言检测状态未更新

1 participant