Skip to content

fix: stop weak-network dialog from popping on every fluctuation - #246

Merged
wsxiaolin merged 1 commit into
mainfrom
fix/suppress-weak-network-dialog
Dec 1, 2026
Merged

wsxiaolin merged 1 commit into
mainfrom
fix/suppress-weak-network-dialog

Conversation

@wsxiaolin

Copy link
Copy Markdown
Member

Problem

The weak-network warning dialog popped up constantly: every network fluctuation (rtt/effectiveType re-estimation), every VPN connect/reconnect/switch, and even toggling Data Saver triggered it. Users on VPN or unstable mobile networks could see it dozens of times per session.

Root cause

registerNetworkListener showed the warning unconditionally inside the connection change handler whenever saveData was set or effectiveType was 2g/3g. The Network Information API fires change on every re-estimation of those values, so on weak links or VPN the handler runs repeatedly and each run popped a new dialog (naive-ui discrete dialog has no dedup).

Fix

  • Remove the weak-network dialog entirely. The silent side effects (cover/avatar image quality suffixes) are still refreshed on change - this keeps the useful behavior without any popup.
  • Keep the offline dialog, now edge-triggered via an offlineShown flag reset on online, so it shows once per actual offline event instead of on every repeated offline firing.
  • networkStatus.poor.* i18n keys are kept (still aligned across locales per check-i18n.mjs) in case the warning is reintroduced later.

Verification

  • npx vue-tsc --build --force: pass
  • npx eslint src/services/utils.ts: 0 errors (one pre-existing max-depth warning on main, untouched)
  • node scripts/check-i18n.mjs: pass
  • npx vite build: pass

(fork PR #245 was closed because the code-review workflow cannot comment on cross-repo fork PRs; this same-repo PR reruns all checks properly.)

The connection 'change' event fires on every rtt/effectiveType/saveData
re-estimation, so weak links and VPN reconnects popped the warning
dialog constantly. Remove the weak-network dialog entirely (image
quality degradation still updates silently) and keep only the offline
dialog, now edge-triggered so it shows once per actual offline event.
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

🤖 Codex-Style Code Review by OpenCode (Vue Best Practice Enabled)

💡 Autonomous AI Reviewer inspecting git commit history and Vue code quality.

Review (fix: stop weak-network dialog from popping on every fluctuation)

Scope: src/services/utils.ts only (1 file, +22/-18). Inspected PR diff vs origin/main, registerNetworkListener call site (src/main.ts:208), and i18n networkStatus keys.

Findings

  • [nit] Stale i18n keys — networkStatus.poor.title/message remain in all locales (src/i18n/{zh,en,ja,fr,de}.ts) but are no longer referenced after removing the weak-network dialog. Consider removing them to avoid dead translation maintenance.

  • [suggestion] Offline detection gated on navigator.connection — registerNetworkListener returns early when connection is unavailable (src/services/utils.ts:89), so the window offline/online handlers are never registered in that case. This is pre-existing behavior, but since offline is now the primary notification path, consider registering offline/online listeners independently of Network Information API support if broader browser coverage is desired.

Notes

  • The fix aligns with the stated cause: connection.change now only refreshes image-quality suffixes (src/services/utils.ts:95-98), avoiding dialog spam from rtt/effectiveType fluctuations.
  • Offline dialog is correctly edge-triggered via offlineShown and reset on online (src/services/utils.ts:100-111).
  • No blocking correctness/security issues found in the changed code.

Verdict: ✅ Approve (non-blocking cleanup/suggestion above). Lint/typecheck not executed: node_modules/eslint binary not present in this environment.

@wsxiaolin
wsxiaolin merged commit b801d5c into main Dec 1, 2026
8 of 11 checks passed
@wsxiaolin
wsxiaolin deleted the fix/suppress-weak-network-dialog branch December 1, 2026 16:44
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.

1 participant