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

Infinite render loop for applications without a <base> #1968

Open
domq opened this issue Oct 8, 2019 · 0 comments
Open

Infinite render loop for applications without a <base> #1968

domq opened this issue Oct 8, 2019 · 0 comments

Comments

@domq
Copy link

domq commented Oct 8, 2019

Because of the unfortunate combination of the following facts,

  • Meteor serves the entire app on any URL that it doesn't recognize,
  • angular-typescript-compiler insists on taking control of the templateUrl so that it doesn't matter whether said URL is absolute or relative — The template always gets fetched from the current URL directory (absent a <base> tag in the HTML <head>),
  • RouterModule demands a base URL, and the first suggestion it provides is the one that fails to paper over the previous issue,

... it is quite easy to run into the situation where the app tries to render itself recursively, ad infinitum.

This appears to have happened before to other people.

Steps that lead me here (with step-by-step reproduction instructions provided in my clone of angular-meteor-base):

  1. git clone https://github.com/Urigo/angular-meteor-base.git
  2. Remove the <base> tag (that's what I did in my own start-from-scratch app, and that is what got me into trouble)
  3. Get error message from router: No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document
  4. Opt for the former approach, hit Stack Overflow and do this
  5. Browse http://localhost:3000/foo/bar and get infinite loop (Maximum call stack size exceeded ; Zone: <root> ; Task: Promise.then ; Value: RangeError: Maximum call stack size exceeded)
  6. Meditate
  7. Using the Chrome dev tools, discover that the app is issuing a query to http://localhost:3000/foo/client/imports/app/app.html, emphasis on /foo/ (which Meteor will serve the entire app for, including another occurence of the &lt;app> tag, which causes the infinite recursion)
  8. Go "aha, why don't I just set an absolute URL for the templateUrl?"
  9. Get no satisfaction
  10. Post this here issue
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

No branches or pull requests

1 participant