-
Notifications
You must be signed in to change notification settings - Fork 11.9k
fix(@angular/ssr): avoid caching non-SSG page lookups #33365
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -167,17 +167,18 @@ export class CommonEngine { | |||||
|
|
||||||
| if (pagePath === resolve(documentFilePath) || !(await exists(pagePath))) { | ||||||
| // View matches with prerender path or file does not exist. | ||||||
| this.pageIsSSG.set(pagePath, false); | ||||||
|
|
||||||
| return undefined; | ||||||
| } | ||||||
|
|
||||||
| // Static file exists. | ||||||
| const content = await fs.promises.readFile(pagePath, 'utf-8'); | ||||||
| const isSSG = SSG_MARKER_REGEXP.test(content); | ||||||
| this.pageIsSSG.set(pagePath, isSSG); | ||||||
| if (isSSG) { | ||||||
| this.pageIsSSG.set(pagePath, true); | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alan-agius4 if (this.pageIsSSG.get(pagePath)) {
// Serve pre-rendered page.
return fs.promises.readFile(pagePath, 'utf-8');
}
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I mean
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought the same thing, I had my doubts, it's already updated in the fixup!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A somewhat tangential request and sorry for the inconvenience. I had two issue tracker reports that resulted in security advisories:
Both issues were closed (infeasible) , but since the corresponding advisories (including credits) were published, would it be possible to review them and update their status to Accepted/Fixed? |
||||||
| return content; | ||||||
| } | ||||||
|
|
||||||
| return isSSG ? content : undefined; | ||||||
| return undefined; | ||||||
| } | ||||||
|
|
||||||
| private async renderApplication(opts: CommonEngineRenderOptions): Promise<string> { | ||||||
|
|
||||||
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.
As I understand, I don't see any use for it when is
false. Additionally, I'm not sure if we would need a test, although I can't think of a way to perform one at the moment.