-
Notifications
You must be signed in to change notification settings - Fork 1
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
SSR + JavaScript without hydration #5
Comments
My thought about this might be a little bit different. Currently Podium does run time composition by composing everything over http. Though I do see that there are some cases where that might not be the most optimal case. There are cases where a layout would benefit form pulling in a podlet as a plain NPM modules. I do imagine that there is a mode where one use this setup to write a podlet in development mode. But, the module is published as a NPM package. What ever the consumer will then pull in this as a dependency as use it as a plain NPM module. In the consumer end it would mean that one pull in a podlet as a dependency and somewhere the project one would need to import the module and use the web component tag. The consumer would then bundle up that podlet in the same way as it does with a plain NPM module since its just a plain NPM module. So. I imagine that this service has a mode for writing a podlet which is intended to be published to NPM as the distribution instead of doing run time composition. That will imply that this module need to export some entry points in the NPM module. Though; we might also want to do dynamic import of podlets as you describe. My thought then is; what is the big difference between importing a podlet through NPM and dynamically importing it? Can we have a mode where a podlet is written so it covers that its either publised to NPM and consumed that way or pulled in through a dynamic import? |
I think I see some different use cases here.
|
There are use cases where it would be nice to be able to SSR the podlet but not hydrate it but still include some script to be executed.
Eg Use Cases.
SSR the podlet, lazy load in tracking JavaScript or other scripts unrelated to the displayed podlet content.
SSR the podlet, its 99% non-interactive, so we manually add the JS to add some minor interactivity rather than hydrate simply because its much less byte expensive to this than to sent the whole component down the wire. (Finn header and footer both do this)
Should we add a file name convention and logic to support these?
One possible solution:
scripts.js
this file is then loaded into the dom AFTER the main script that hydrates or defines the podletlazy.js
, this file is loaded using dynamic import() after window load event has fired. A user can use this to load non critical path JS such as tracking scripts.These files would typically be used in the following use cases like so:
The text was updated successfully, but these errors were encountered: