Skip to content

frontend: Discard tray MAVLink listeners on destroy - #4046

Open
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:pr/tray-mavlink-listener-discard
Open

frontend: Discard tray MAVLink listeners on destroy#4046
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:pr/tray-mavlink-listener-discard

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

  • HealthTray HEARTBEAT and GpsTrayMenu GPS listeners are stored with markRaw and discard()ed in beforeDestroy.
  • Avoids stacking callbacks on shared MAVLink2Rest endpoints (and deep-observing Endpoint.latestData every frame).

Test plan

  • Heartbeat icon and GPS trays still update normally
  • Remount / HMR of App tray: listener count does not grow (no duplicate HEARTBEAT handling)
  • No regression in armed state / GPS fix display

Supersedes #4033 (recreated from fork joaoantoniocardoso/BlueOS-docker instead of same-repo head).

@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: LGTM :shipit:

Fixes listener leaks in the health/GPS tray components: HEARTBEAT and GPS listeners are now stored on the instance and discard()ed in beforeDestroy, and wrapped in markRaw so Vue 2.7's reactivity system does not deep-observe Endpoint.latestData on every incoming MAVLink frame. Directly addresses the AGENTS.md rule "Frontend > 3: Forgetting cleanup — Clear intervals/timeouts in beforeDestroy()", and uses the existing Listener.discard() API (core/frontend/src/libs/MAVLink2Rest/Listener.ts:59, which both clears the interval and removes the listener from the endpoint). markRaw is a valid import in Vue 2.7.14 (per core/frontend/yarn.lock).

No further comments, nice job 👍

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

@joaoantoniocardoso joaoantoniocardoso added the move-to-stable Needs to be cherry-picked and move to stable label Jul 27, 2026
Store HEARTBEAT/GPS listeners with markRaw and discard them in
beforeDestroy so remounts do not stack callbacks on shared endpoints.
@joaoantoniocardoso
joaoantoniocardoso force-pushed the pr/tray-mavlink-listener-discard branch from 65af139 to 2766059 Compare July 28, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

move-to-stable Needs to be cherry-picked and move to stable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant