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

Move initialChunks store variable to window global variable #1013

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ahce
Copy link

@ahce ahce commented Sep 6, 2024

Summary

Supports calling loadableReady once, when there are multiple hydration entry points.

Example:

  • main entry:
initSomething()

loadableReady(() => {
  window.dispatchEvent(new CustomEvent('loadable:ready'))
})
  • app1 entry:
window.addEventListener('loadable:ready', () => {
  hydrateRoot(document.getElementById('app-1'), <App1 />)
})
  • app2 entry:
window.addEventListener('loadable:ready', () => {
  hydrateRoot(document.getElementById('app-2'), <App2 />)
})

Note

To make this with the current version, the namespace property must be implemented for each entry with the loadableReady call, also the required chunks are duplicated for each JSON script when the different apps use the same component.

Test plan

No changes were applied that modify the current behavior.

@ahce
Copy link
Author

ahce commented Sep 23, 2024

Hi @theKashey , can you review this please? 🙏

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.

1 participant