Using loadable with Volto Manage Component

Is there a particular reason why Volto does not use @loadable/component or React.lazy to load component?

All visitors would benefit if these are lazy load: e.g. ControlPanel, Widgets, Contents, Form, Toolbar, Sidebar, Rules, Sharing, Editing, Diff, History, BlockChooser.

Lazy Loading these component will reduce the size of the client.js and improve the performance for every user.

(edited question and title)

h

Volto uses @loadable/component instead of React.lazy for lazy-loading. There is some documentation here: Lazy loading – Frontend – Development — Plone Documentation v6.0

My understanding is that React.lazy does not work with server-side rendering.

I'm sure there are more components that would make sense to switch to lazy loading, if someone is willing to put in the effort.

Thanks, I refactor all the component I implemented react.lazy to use @loadable/component. while on development mode react.lazy worked fine but once I build it it gave me the error.

My point is that ControlPanel, Widgets, Contents, Form, Toolbar, Sidebar, Rules, Sharing, Editing, Diff, History, BlockChooser are not using @loadable/component and they are loaded by everybody that visit the site when 99% will not use this code

In Volto 18 a good chunk (hehe) of those components are indeed loaded lazily, and we plan to work more on that soon at Salamina Sprint

See all the discussion and the work that has been done in this PLIP and the PR linked inside:

1 Like

Thanks, this is exactly what I was looking for, I was going to add a PLIP on this if there wasn't one, can I participate remotely?

Of course you can! You can find the info in the page linked above or at https://salaminasprint.redturtle.it/