[wp-trac] [WordPress Trac] #59462: Blocks: Introduce a way to enqueue view scripts only when needed for interactivity
WordPress Trac
noreply at wordpress.org
Wed Sep 4 22:24:49 UTC 2024
#59462: Blocks: Introduce a way to enqueue view scripts only when needed for
interactivity
-----------------------------+-----------------------
Reporter: gziolo | Owner: (none)
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.7
Component: Editor | Version: 6.4
Severity: normal | Resolution:
Keywords: gutenberg-merge | Focuses:
-----------------------------+-----------------------
Comment (by westonruter):
Should the scope here include not just the initial enqueueing of the
dependent assets (scripts and styles) but also deferring the loading of
them until they are needed? For example, the view script for the
lightboxed Image block doesn't need to be loaded until the Image block is
scrolled into the viewport.
This is where there is an intersection with lazy-hydration since the
interactive island doesn't need to be initialized either until the block
enters the viewport, the same as the scripts aren't needed until the block
is in the viewport. As I understand, the process would be that once a
block enters the viewport (1) download the scripts required by the block,
and then (2) perform hydration.
This is also related to client-side navigation, as navigating to a page
with an interactive block would also require its assets to be downloaded
(but ideally not downloaded immediately but rather delayed until the block
is in the viewport, especially for view script modules).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59462#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list