Skip to content

fix: clear stale mesh v2 domain from localStorage when modal opens#328

Merged
takaokouji merged 3 commits intodevelopfrom
fix/mesh-v2-stale-domain-cache
Mar 17, 2026
Merged

fix: clear stale mesh v2 domain from localStorage when modal opens#328
takaokouji merged 3 commits intodevelopfrom
fix/mesh-v2-stale-domain-cache

Conversation

@takaokouji
Copy link

Summary

  • メッシュv2でdomain未指定時にlocalStorageに残った古いドメインが使われ、同じWiFi上の端末同士でグループが見えなくなるバグを修正
  • 接続モーダルを開いた時にReduxのdomainをnullにリセットし、ボタンクリック時にextensionのdomainをクリアすることでcreateDomain()によるIP自動検出が正しく動作するようにした
  • ユニットテスト3件を追加

Changes Made

根本原因

  1. ユーザーが過去にドメインを手入力 → saveDomainToLocalStorage() でキャッシュ
  2. 次回、extensionコンストラクタで getDomainFromLocalStorage() が古い値を返す
  3. syncMeshV2Domain() がReduxにも古い値を同期
  4. ユーザーがドメインを入力しなくても古い値が裏で使われ、createDomain() が呼ばれない

修正内容

  • connection-modal.jsx: meshV2モーダルを開く時にRedux domainをnullにリセット(ドメイン入力欄を空で表示)
  • connection-modal.jsx: 「ホストになる」「参加する」クリック時にdomainが空なら extension.setDomain(null) でlocalStorageをクリア → createDomain() によるIP自動検出が行われる

Test Coverage

  • Playwright MCPでRED(バグ再現)→ GREEN(修正確認)をTDD的に検証
  • ユニットテスト追加:
    • モーダルオープン時にRedux domainがnullにリセットされること
    • 接続済みの場合はリセットされないこと
    • domain空の場合にmeshV2Initialフェーズが表示されること

Related Issues

Fixes #327

takaokouji and others added 2 commits March 18, 2026 01:05
When users previously entered a domain manually, it was cached in
localStorage. On subsequent sessions without domain input, the stale
cached value was silently used instead of auto-detecting via
createDomain(), causing devices on the same network to get different
domains and be unable to find each other's mesh groups.

Reset Redux meshV2 domain to null when the connection modal opens,
and clear the extension domain when the user clicks Create/Join
without entering a domain.

Fixes #327

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Verify Redux domain is reset to null when meshV2 modal opens
- Verify domain is NOT reset when already connected
- Verify phase is meshV2Initial when domain is empty

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

…open

The previous approach reset Redux domain to null when the modal opened,
which cleared explicitly-entered domains on reload. Instead, track
whether the user changed the domain input during the current modal
session. Only clear the cached domain when the user did not explicitly
change it, preserving intentionally-set domains across reloads.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@takaokouji takaokouji merged commit c6d974c into develop Mar 17, 2026
9 checks passed
@takaokouji takaokouji deleted the fix/mesh-v2-stale-domain-cache branch March 17, 2026 16:36
github-actions bot pushed a commit that referenced this pull request Mar 17, 2026
…tale-domain-cache

fix: clear stale mesh v2 domain from localStorage when modal opens
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.

fix: メッシュv2でdomain未指定時にlocalStorageの古いドメインが使われグループが見えないバグ

1 participant