Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stimulus] Fasten lazy loading + add debug lazy:loading and lazy:loaded #2463

Open
wants to merge 3 commits into
base: 2.x
Choose a base branch
from

Conversation

smnandre
Copy link
Member

Q A
Bug fix? no
New feature? yes
Issues Fix #...
License MIT

This PR..

  1. improves the controller lazy loading by tuning algorithm (early exit, remove await, ...)

  2. introduces two new debug events in the console to ease DX with lazy controllers

    • my-controller#lazy:loading when the lazy controller is detected in the DOM
    • my-controller#lazy:loaded after the file has been downloaded and imported

I would really like some feedback / tests IRL (especially with Webpack i'm not used to)

@carsonbot carsonbot added Feature New Feature Status: Needs Review Needs to be reviewed labels Dec 22, 2024
@smnandre smnandre requested review from Kocal and kbond December 22, 2024 02:40
Copy link

📊 Packages dist files size difference

Thanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
Please review the changes and make sure they are expected.

FileBefore (Size / Gzip)After (Size / Gzip)
StimulusBundle
loader.js 3.2 kB / 910 B 3.8 kB+19% 📈 / 1.01 kB+14% 📈

@Kocal
Copy link
Member

Kocal commented Dec 22, 2024

I would really like some feedback / tests IRL (especially with Webpack i'm not used to)

I will try to find some time to rebuild a Symfony + Encore app, but by reading your changes it looks fine to me (feel free to reping me if necessary)

@smnandre
Copy link
Member Author

@MatTheCat ? 👼

@Kocal
Copy link
Member

Kocal commented Dec 22, 2024

I'm testing

@Kocal
Copy link
Member

Kocal commented Dec 22, 2024

Well... I've just realized, but to use Stimulus in a Symfony App with Webpack Encore, we use the https://github.com/symfony/stimulus-bridge ... which is not in this repository (and so not modified by this PR) 😅

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Dec 22, 2024
@smnandre
Copy link
Member Author

Well.... let me tell you i have no intention of coding in the Bridge hahaha

(i'll have a look but the lazy loading is done differently if i remember correctly)

@MatTheCat
Copy link
Contributor

I’ve got nothing to test then? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Feature New Feature Status: Reviewed Has been reviewed by a maintainer StimulusBundle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants