fix: make VFToolbar synchronous instead of loading its own chunk - #12
Open
mamico wants to merge 1 commit into
Open
fix: make VFToolbar synchronous instead of loading its own chunk#12mamico wants to merge 1 commit into
mamico wants to merge 1 commit into
Conversation
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.
giuliaghisini
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VFToolbaris mounted on every route for every visitor viaappExtras(match: ''). A previous fix already isolated it into its ownVoltoFeedbackViewchunk instead of bundling it with the heavierVoltoFeedbackManagepanels (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.VFToolbarhas no heavy dependencies (Icon,Plug,react-intl,react-router-dom'sLinkare 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.VFPanel/VFPanelMenu/FeedbackCommentsstay lazy underVoltoFeedbackManage, unchanged.Related to a similar fix applied in
@redturtle/volto-newsletterfor the sameappExtras-loadable pattern (RedTurtle/volto-newsletter#9).Test plan
node --checkon the modified fileVFToolbar/VFPanel/VFPanelMenu/FeedbackCommentshave no other usages relying onloadable()-specific behavioryarn buildof a consuming Volto app compiled successfully with this change in placefeedback-dashboardpermission, and that anonymous page loads no longer request aVoltoFeedbackViewchunk