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

feat: keep track of which resources have emitted early hints and emit complete event once all resources have emitted #421

Merged
merged 6 commits into from
Sep 24, 2024

Conversation

digitalsadhu
Copy link
Member

This is phase 2b or phase 3a.

Needs: podium-lib/utils#261

This change uses a new property on http incoming to track which resources have received early hints back. When all resources have responded with their early hints, incoming.hints will automatically emit a 'complete' event.

… complete event once all resources have emitted
@wkillerud
Copy link
Contributor

Came to think of, what happens if one or more podlets don't send an early hint (like if it's down, or on a version that doesn't send those hints)?

Base automatically changed from write_early_hints_to_browser to next September 20, 2024 01:31
@digitalsadhu
Copy link
Member Author

Came to think of, what happens if one or more podlets don't send an early hint (like if it's down, or on a version that doesn't send those hints)?

Good catch, if the podlet is down, the fallback will be pushed and this will also qualify as having received hints.
Still need to handle the case of a podlet that doesn't support the hints.

@digitalsadhu
Copy link
Member Author

I think it's fair to say that this a feature that only makes sense if all podlets have been upgraded. The feature needs all podlets to be early hinting their assets (or fallbacks) to be able to send the document head early. The best we could do would be to go straight to fallback for podlets that dont support the feature which isn't ideal and is tricky to implement since we would either need to add something to the podlet manifest so that the client can tell if its dealing with old v new or otherwise add a timeout which would add complexity and negate the benefits of sending the header early.

So, I think we just say that all podlets need to be upgraded before a layout can use this feature. The actual version would be non breaking and so safe to update all layouts but the feature would require consciously upgrading podlets to be using early hints.

@digitalsadhu digitalsadhu merged commit 51c0251 into next Sep 24, 2024
7 checks passed
@digitalsadhu digitalsadhu deleted the track_early_hints_across_resources branch September 24, 2024 00:26
Copy link

🎉 This PR is included in version 5.2.0-next.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Nov 6, 2024

🎉 This PR is included in version 5.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants