-
Notifications
You must be signed in to change notification settings - Fork 12
fix: Catch router errors #21
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
Conversation
✔️ Deploy Preview for plugin-angular-universal-demo ready! 🔨 Explore the source changes: 2c9dcde 🔍 Inspect the deploy log: https://app.netlify.com/sites/plugin-angular-universal-demo/deploys/610b100ebaff8e0007c231d8 😎 Browse the preview: https://deploy-preview-21--plugin-angular-universal-demo.netlify.app |
src/helpers/getDynamicTemplates.js
Outdated
} catch (e) { | ||
const html = await render(event, context) | ||
return { | ||
// todo: how would people change the status code from inside angular code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likely needs a bit of injection...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work on this.Thank you! I'd be inclined to move the example stuff out of the demo for now though, and maybe put it in examples or something. We want demo to be as vanilla as possible (it's basically the standard Angular "Tour of Heroes" app)
src/helpers/getDynamicTemplates.js
Outdated
|
||
export * from './src/main.server' | ||
const html: string = await new Promise((resolve, reject) => { | ||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding /// <reference types="zone.js" />
to the top of the file should make this work
const getAngularBuilder = ({ functionServerPath }) => ` | ||
const outdent = require('outdent') | ||
// this is here so this works: https://marketplace.visualstudio.com/items?itemName=zjcompt.es6-string-javascript | ||
const javascript = outdent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice trick! I wonder if we should update our eslint rules so we could use an inline comment instead though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i initially just added outdent because i didn't like the leading spaces in the rendered files. then just aliased it to this name for convience
src/helpers/getDynamicTemplates.js
Outdated
if (!!query) { | ||
query = '?' + query; | ||
} | ||
return "https://" + event.headers.host + event.path + query; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event.headers['x-forwarded-proto'] || 'http'
i reverted my changes to the demo site and addressed the comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marcus, you're an absolute legend for this. we owe you x10000!!!! 🙏 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
This adds a zone.js Zone to catch all errors bubbling up from rendering the app module.
In the process i made these refactors:
@nguniversal/express-engine
with@nguniversal/common/engine
for less indirection