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

Avoid having to put the client bootstrap in DOMContentLoaded for TransferState to work properly #20484

Closed
vikerman opened this issue Nov 16, 2017 · 6 comments
Assignees
Labels
area: server Issues related to server-side rendering feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Milestone

Comments

@vikerman
Copy link
Contributor

vikerman commented Nov 16, 2017

Currently the client of a SSR Angular app needs to wait for DOMContentLoaded to complete before bootstrapping so that TransferState can reliably get the contents of the transferred state from the DOM.

Need to investigate whether we can handle this more transparently without the user needing to bootstrap in a specific way on the client side.

@jcao02
Copy link

jcao02 commented Nov 28, 2017

@vikerman do you suggest doing something like this?

document.addEventListener('DOMContentLoaded', () => {
  platformBrowserDynamic().bootstrapModule(AppModule);
});

@alxhub alxhub added the feature Issue that requests a new feature label Dec 12, 2017
@ngbot ngbot bot added this to the Backlog milestone Jan 23, 2018
jorroll pushed a commit to jorroll/angular that referenced this issue Sep 20, 2018
Updates TransferState documentation to make note of angular/angular issue angular#20484 and the fact that `BrowserTransferStateModule` requires changing a typical Angular app's bootstrap process in order to work properly.
@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Jun 4, 2021
@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 4, 2021

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 26, 2021

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

@angular-robot angular-robot bot added the feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors label Jun 26, 2021
@jessicajaniuk jessicajaniuk added feature: under consideration Feature request for which voting has completed and the request is now under consideration and removed feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors feature: votes required Feature request which is currently still in the voting phase labels Jul 18, 2022
@nicolae536
Copy link

Thanks this made us to understand why a critical bug happens just some times. I agree this should be part of angular function but anyway is good that there is a easy fix for it.

@alan-agius4
Copy link
Contributor

The script tag that loads the main.js file can be deferred using the defer attribute.

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2023
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: server Issues related to server-side rendering feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants