Feature/nuclear historical profiles#3859
Conversation
|
@noishey is attempting to deploy a commit to the World Monitor Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds interactive historical-profile accordions to nuclear facility tooltips on both the 2D Leaflet map (
Confidence Score: 4/5Safe to merge; the accordion and timer changes are additive and isolated to nuclear site tooltips, with no impact on other map layers. The feature is well-contained and both rendering paths use proper HTML escaping. The one rough edge is in GlobeMap's mouseleave handler, which can leave an orphaned 3500 ms timer running after the accordion close-branch has already armed one — because this.tooltipHideTimer is overwritten without first canceling the old handle. In practice hideTooltip() is idempotent, so the stale callback fires harmlessly, but a sufficiently fast hover sequence could cause it to dismiss a newly opened tooltip for a different marker. src/components/GlobeMap.ts — specifically the mouseleave handler and the ordering of the auto-hide timer relative to the toggle listener setup. Important Files Changed
Reviews (1): Last reviewed commit: "fix: resolve globe type regression, smoo..." | Re-trigger Greptile |
| el.addEventListener('mouseleave', () => { | ||
| const details = el.querySelector('.historical-profile-accordion') as HTMLDetailsElement | null; | ||
| if (details && details.open) return; | ||
| this.tooltipHideTimer = setTimeout(() => this.hideTooltip(), 2000); | ||
| }); |
There was a problem hiding this comment.
Orphaned timer on mouseleave after accordion close
The mouseleave handler assigns this.tooltipHideTimer without first clearing the existing value. When the accordion's toggle close-branch has already armed a 3500 ms timer and the user then moves the mouse out of the tooltip (accordion already closed), the mouseleave handler overwrites this.tooltipHideTimer with a fresh 2000 ms timer — leaving the old 3500 ms timer running and untracked. Both timers eventually fire hideTooltip(), which is idempotent, but the orphaned timer means any subsequent clearTimeout(this.tooltipHideTimer) call (e.g. from mouseenter) only cancels the 2000 ms one; the earlier 3500 ms timer can still dismiss an unrelated tooltip that opened in the meantime.
| el.addEventListener('mouseleave', () => { | |
| const details = el.querySelector('.historical-profile-accordion') as HTMLDetailsElement | null; | |
| if (details && details.open) return; | |
| this.tooltipHideTimer = setTimeout(() => this.hideTooltip(), 2000); | |
| }); | |
| el.addEventListener('mouseleave', () => { | |
| const details = el.querySelector('.historical-profile-accordion') as HTMLDetailsElement | null; | |
| if (details && details.open) return; | |
| if (this.tooltipHideTimer) { clearTimeout(this.tooltipHideTimer); this.tooltipHideTimer = null; } | |
| this.tooltipHideTimer = setTimeout(() => this.hideTooltip(), 2000); | |
| }); |
| const details = el.querySelector('.historical-profile-accordion'); | ||
| if (details) { | ||
| details.addEventListener('toggle', (e) => { | ||
| const target = e.target as HTMLDetailsElement; |
There was a problem hiding this comment.
Using the generic overload
querySelector<HTMLDetailsElement> returns a precise HTMLDetailsElement | null type, removing the need for the runtime cast inside the listener and making the target.open access inherently type-safe.
| const details = el.querySelector('.historical-profile-accordion'); | |
| if (details) { | |
| details.addEventListener('toggle', (e) => { | |
| const target = e.target as HTMLDetailsElement; | |
| const details = el.querySelector<HTMLDetailsElement>('.historical-profile-accordion'); | |
| if (details) { | |
| details.addEventListener('toggle', (e) => { | |
| const target = e.target as HTMLDetailsElement; |
Summary
This PR introduces interactive historical profile timelines for nuclear facility layers on both the 2D Flat Map and the 3D Globe views.
Key Accomplishments:
<details>components inside flat map Leaflet popups (MapPopup.ts) and 3D globe canvas hover tooltips (GlobeMap.ts) to reveal site timelines on-demand.transition: transform 0.2s ease-in-out;) for summary headers and rotation arrows inside the accordion component.los_alamosandoak_ridge) insrc/config/geo.ts.GlobeMap's hover system. Expanding the historical accordion automatically cancels the auto-hide timer (clearTimeout(this.tooltipHideTimer)). Tooltips will now stay open indefinitely for easy reading and re-arm standard timers upon collapse or mouse-out.Type of change
Affected areas
/api/*)Checklist
api/rss-proxy.jsallowlist (if adding feeds)npm run typecheck)