TimZander / TimZander/life-compass

The bridge setting does not reach other tabs, a restored page, or a second wiring

Open
#84 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
8h 34m
Merged PRs (30d)
3

Description

Problem

Three related gaps in how the assistant opt-in propagates.

  1. No storage listener anywhere. Switch the bridge on in one tab and every other open tab keeps its worksheets bare until reloaded. Switch it off and the other tabs keep offering copy buttons for a feature the reader has just declined — the wrong direction for a privacy control.
  2. No bfcache handling. A back-navigation restores the page from cache with the old value, including the checkbox on /agent showing a setting that is no longer true.
  3. wireAgentPage is not idempotent, while wireQuestionControls is (it has an explicit guard and a test). A second call adds a second change listener, so the toggle double-fires and raises its banner twice. Nothing calls it twice today — but #68's import path re-runs the wiring, which is exactly where this will land.

Why it matters

ADR 0007 rests on the opt-in being real rather than nominal. A setting that only takes effect in the tab that changed it, and only until something restores a page from cache, is nominal in the other tabs.

Proposed solution

Listen for storage on the preference key and re-run the wiring — which requires the guard from (3) to exist first, so do that one first. Handle pageshow with event.persisted for the bfcache case. Both are small; the ordering is the only subtlety.

Acceptance criteria

  1. Switching the bridge off in one tab removes the controls from another open worksheet tab without a reload.
  2. Switching it on adds them.
  3. A bfcache back-navigation shows controls matching the current setting, and /agent's checkbox matches it.
  4. Calling wireAgentPage twice leaves one listener and raises one banner.
  5. Negative case: a storage event for an unrelated key changes nothing.

Contributor guide

No contributing guide indexed for this repository

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 wireAgentPage and the existing idempotency guard and test for wireQuestionControls; trace how the preference key is read and how worksheet and /agent wiring is triggered. Add coverage for repeated agent wiring, relevant storage events, and pageshow restoration, then verify the acceptance criteria including the unrelated-key negative case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.