Skip to content

fix(eew): end an early warning the live stream stopped sending - #35

Merged
whes1015 merged 1 commit into
mainfrom
fix/eew-area-residue
Oct 27, 2026
Merged

whes1015 merged 1 commit into
mainfrom
fix/eew-area-residue

Conversation

@whes1015

Copy link
Copy Markdown
Member

Platform: all

Fix(zh-Hant): 地震預警結束後,地圖不會再卡在預估震度的鄉鎮填色
Fix(en-US): the map no longer stays coloured by a warning's predicted intensity after it ends

問題回報:ET-2026-0179(卡在強震即時警報預估震度畫面),附件 log 161.log 的時間軸可直接對上。

原因

預警只會在發布/更新時由 SSE 送進來,結束不會另外送。即時模式在連線活著時,輪詢只幫震度速報做逾時老化,漏了 EEW,所以伺服器在 16:45:04 已經送了空清單、發震也早就超過 240 秒,本機的 variable.data.eew 仍留著 1150075 → EewEnd 永遠不會發 → 預估震度的鄉鎮填色(feature state)沒有東西會把它塗回去。10 分鐘後 eew_cache 自己到期,只清掉圓環圖層與資訊卡,畫面就變成「卡片說暫無預警、地圖還是一片藍」。

修法

  • data.ts:SSE 活著時的每輪輪詢也對 EEW 做老化(與 HTTP 輪詢、震度速報同一條路),時間到就正常發 EewEnd。
  • estimate.ts:重畫鄉鎮填色時只認 variable.data.eew 裡還在的預警,不在的面積直接丟棄;alertedCities 的清空移到守衛之前,單一預警結束那條路本來清不到。
  • eew.ts:快取到期改成發 EewEnd,讓各模組自己收乾淨,而不是只拿掉自己那幾層。

驗證

  • bun run typecheck、bun run build:web 通過;bun run lint 只剩 preview.tsx 原有的 react-refresh warning。
  • 依回報的 log 重建 1150075 逾時後的狀態做無頭重現,讓 fetchData 走 SSE 分支:修之前 EewEnd 0 次、data.eew 仍有 1 筆、預估面積還在、2 個鄉鎮填色沒退;修之後 EewEnd 1 次、data.eew 0 筆、面積清空、填色歸零。
  • 未驗證:真實即時預警的端到端結果(要等下一次實際 EEW),以及桌面版實機。

Platform: all

An EEW reaches the app only when it is issued or updated; the stream never
says it expired. The live loop aged shake reports but not EEWs, so one the
server had already stopped listing stayed active: the towns kept the colour
of its predicted intensity, and every later earthquake waited behind it
until the window was reloaded.

Age EEWs on every live poll the way the HTTP loop does, keep a predicted
area off the map once its EEW is no longer active, and let the EEW cache's
own expiry announce the end instead of dropping layers without a word.

Fix(zh-Hant): 地震預警結束後,地圖不會再卡在預估震度的鄉鎮填色
Fix(en-US): the map no longer stays coloured by a warning's predicted intensity after it ends
@whes1015
whes1015 merged commit 8ccb9c6 into main Oct 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant