Lazify pat-upload: split registration from implementation#1616
Open
MrTango wants to merge 1 commit into
Open
Conversation
pat-upload contributed ~17KB src to the eager patterns chunk on every page, though the upload UI only appears in folder contents and upload dialogs. Split it into a thin registration module and upload--implementation.js holding the jquery/underscore/i18n wiring and the lazily-loaded Dropzone integration. The thin module keeps registering the .pat-upload trigger and grafts the implementation prototype on first match. Public options and emitted markup are unchanged. pat-structure, pat-relateditems and the contentbrowser app construct upload imperatively (new Upload(...)) and use the instance right away. The implementation therefore stays a constructable Base.extend pattern and those callers import it directly, so new Upload() yields a fully formed instance synchronously. Registry.register is first-wins, so the eagerly imported thin module remains the registered .pat-upload pattern; the implementation is only reached via lazy chunks (the structure app view, the contentbrowser component and the relateditems dynamic import). Add a regression test asserting the implementation is constructable and exposes its methods synchronously. The implementation now loads only where a .pat-upload element exists.
petschki
force-pushed
the
mockup-lazy-upload
branch
from
July 17, 2026 09:06
bfd684d to
dc5068b
Compare
Member
|
/run-coredev-6.3-robottests |
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.
pat-upload contributed ~17KB src to the eager patterns chunk on every page, though the upload UI only appears in folder contents and upload dialogs.
Split it into a thin registration module and upload--implementation.js holding the jquery/underscore/i18n wiring and the lazily-loaded Dropzone integration. The implementation is grafted onto the single pattern instance in init(), so consumers that instantiate Upload directly (pat-structure, pat-relateditems, the contentbrowser app) keep working. Public options and emitted markup are unchanged.
The implementation now loads only where a .pat-upload element exists.
addresses #1618