Skip to content

Mockup lazy modal - #1617

Merged
petschki merged 1 commit into
masterfrom
mockup-lazy-modal
Jul 17, 2026
Merged

Mockup lazy modal#1617
petschki merged 1 commit into
masterfrom
mockup-lazy-modal

Conversation

@MrTango

@MrTango MrTango commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Merge after the pat-recurrence PR #1614!

Lazify pat-modal: thin registration module + lazy jquery-form

Split the ~1000-line pat-modal implementation out of the every-page
eager patterns chunk. modal.js becomes a thin registration module that
loads modal--implementation.js on first .pat-plone-modal match; the
implementation grafts onto the instance from the prototype, since
imperative callers still do new Modal().

jquery-form ($.fn.ajaxSubmit) moves from a top-level import to a lazy
await import("jquery-form") at its single call site in
handleFormAction, so it no longer loads on every page.

Imperative importers are repointed at modal--implementation:
controlpanels (registry / dexterity-types-listing / contentrule-elements)
and recurrence load it as part of their own lazy implementation chunks;
manageportlets is registered eagerly, so it loads the impl on demand
inside showEditPortlet. Side-effect registration imports (patterns.js,
tinymce links, structure actionmenu) keep pointing at the thin module.

Depends on the pat-recurrence lazification: recurrence is eagerly
registered, so its Modal import must live in recurrence--implementation
(a lazy chunk) for the modal body to actually leave the eager bundle.

addresses #1618

@petschki petschki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I've rebased this PR on top of the new #1614 commit, so once this is merged, the commit here disappears after rebasing.

@petschki
petschki force-pushed the mockup-lazy-modal branch from ee6a5b5 to 069d496 Compare July 17, 2026 10:07
Split the ~1000-line pat-modal implementation out of the every-page
eager patterns chunk. modal.js becomes a thin registration module that
loads modal--implementation.js on first .pat-plone-modal match; the
implementation grafts onto the instance from the prototype, since
imperative callers still do `new Modal()`.

jquery-form ($.fn.ajaxSubmit) moves from a top-level import to a lazy
`await import("jquery-form")` at its single call site in
handleFormAction, so it no longer loads on every page.

Imperative importers are repointed at modal--implementation:
controlpanels (registry / dexterity-types-listing / contentrule-elements)
and recurrence load it as part of their own lazy implementation chunks;
manageportlets is registered eagerly, so it loads the impl on demand
inside showEditPortlet. Side-effect registration imports (patterns.js,
tinymce links, structure actionmenu) keep pointing at the thin module.

Depends on the pat-recurrence lazification: recurrence is eagerly
registered, so its Modal import must live in recurrence--implementation
(a lazy chunk) for the modal body to actually leave the eager bundle.
Merge after the pat-recurrence PR.
@petschki
petschki force-pushed the mockup-lazy-modal branch from 069d496 to 74a7eb1 Compare July 17, 2026 10:10
@petschki
petschki merged commit a20b2e7 into master Jul 17, 2026
3 checks passed
@petschki
petschki deleted the mockup-lazy-modal branch July 17, 2026 10:13
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