Skip to content

[backport/1.4] Improve frontend: only get Kernel/Journal when needed - #4063

Open
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:1.4-devfrom
joaoantoniocardoso:backports/1.4/lazy-kernel-journal
Open

[backport/1.4] Improve frontend: only get Kernel/Journal when needed#4063
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:1.4-devfrom
joaoantoniocardoso:backports/1.4/lazy-kernel-journal

Conversation

@joaoantoniocardoso

Copy link
Copy Markdown
Member

This is a backport of #4025 into 1.4.

Backport of bluerobotics#4025 for 1.4 (kernel only; Journal UI is not on this branch).
Stop opening the kernel WebSocket at SPA boot; subscribe on Kernel mount and
unsubscribe/clear on destroy. Only mount the active System Information tab.
@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: MINOR SUGGESTIONS ✏️

Backports #4025 to 1.4-dev: the kernel-buffer WebSocket is no longer opened eagerly at module load; instead Kernel.vue's mounted() / beforeDestroy() hooks refcount subscribers via new subscribeKernelMessages / unsubscribeKernelMessages helpers, and SystemInformationView.vue only mounts the currently-active tab so the socket actually tears down when the user leaves. Journal.vue is deliberately not touched here — it does not yet exist on 1.4-dev, which explains the "Kernel/Journal" wording in the title.

6. Code Quality & Style

  • 6.1 [minor] core/frontend/src/store/system-information.ts — two spots now contain two consecutive blank lines, which will trip airbnb's no-multiple-empty-lines (max: 1) and fail yarn --cwd core/frontend lint:

    • Between the new updateModel mutation and updateNetstat (the + blank line at diff hunk 2 / around post-image line ~95).
    • Between updateSystemUnixTimeSeconds and fetchModel after removing fetchKernelMessage — the two surrounding blank lines were left in place (diff hunk 3, around post-image line ~184).

    yarn --cwd core/frontend lint --fix will collapse both.

8. Documentation

  • 8.1 [nit] core/frontend/src/store/system-information.ts — the replacement comment ("Vuex store modules are a poor fit for WebSocket callbacks; keep sockets outside the store and open them only while a UI consumer is mounted (Kernel tab).") is a solid improvement over the previous "It appears that the store is incompatible..." — reads as a real explanation of the why.

9. Nitpicks / Optional

  • 9.1 [nit] core/frontend/src/views/SystemInformationView.vue:82page_selected: 0 as number changes the initial selected tab from "none" (null) to the first tab (Processes). This is required for the new <template v-if="page_selected === index"> gate to render anything on first paint, and matches Vuetify's implicit numeric v-model on <v-tabs> with no explicit :value per tab, so it's the correct fix — just calling out that it's a subtle user-visible behavior change worth eyeballing on 1.4-dev.
  • 9.2 [nit] Conditionally mounting only the active tab (the <template v-if> wrap) means per-tab local state (scroll position, filter fields, transient UI state in Processes/Network/Firmware) is now discarded on every tab switch. That's an intentional tradeoff for tearing down the kernel WS, but a maintainer should be aware of it since the previous behavior kept all six tabs alive.

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

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