Skip to content

fix: make VFToolbar synchronous instead of loading its own chunk - #12

Open
mamico wants to merge 1 commit into
mainfrom
fix/toolbar-synchronous-no-chunk
Open

fix: make VFToolbar synchronous instead of loading its own chunk#12
mamico wants to merge 1 commit into
mainfrom
fix/toolbar-synchronous-no-chunk

Conversation

@mamico

@mamico mamico commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

  • VFToolbar is mounted on every route for every visitor via appExtras (match: ''). A previous fix already isolated it into its own VoltoFeedbackView chunk instead of bundling it with the heavier VoltoFeedbackManage panels (see the comment it left behind) - correct, but partial: it still triggered a separate ~5KB network request on every single page load just to run its own permission check (state.actions.actions), which resolves to nothing for the vast majority of visitors.
  • VFToolbar has no heavy dependencies (Icon, Plug, react-intl, react-router-dom's Link are already part of the main bundle for any Volto app), so there's nothing to gain from lazy-loading it - only a wasted round-trip.
  • Exported it as a plain synchronous component. VFPanel/VFPanelMenu/FeedbackComments stay lazy under VoltoFeedbackManage, unchanged.

Related to a similar fix applied in @redturtle/volto-newsletter for the same appExtras-loadable pattern (RedTurtle/volto-newsletter#9).

Test plan

  • node --check on the modified file
  • Verified VFToolbar/VFPanel/VFPanelMenu/FeedbackComments have no other usages relying on loadable()-specific behavior
  • Full yarn build of a consuming Volto app compiled successfully with this change in place
  • Confirm in a running site that the toolbar still renders/links correctly for users with the feedback-dashboard permission, and that anonymous page loads no longer request a VoltoFeedbackView chunk

VFToolbar is mounted on every route for every visitor via appExtras
(match: ''), and already had its own comment explaining why it was split
into a separate "VoltoFeedbackView" chunk instead of "VoltoFeedbackManage":
to avoid pulling in the heavy admin panels for anonymous visitors. That
fix was correct but partial - VFToolbar still triggered an extra network
round-trip (~5KB) on every single page load just to run its own
permission check (state.actions.actions), even though it has no heavy
dependencies (Icon, Plug, react-intl, react-router-dom Link are already
part of the main bundle).

Export it as a plain synchronous component instead, removing that
per-page chunk fetch entirely. VFPanel/VFPanelMenu/FeedbackComments stay
lazy in VoltoFeedbackManage, only pulled in once the toolbar link
actually navigates to /feedback-panel.
@mamico
mamico requested review from giuliaghisini and pnicolli July 29, 2026 10:05
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.

2 participants