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

[Issue #2622] Update opp page for ISR #2724

Merged
merged 6 commits into from
Nov 12, 2024
Merged

[Issue #2622] Update opp page for ISR #2724

merged 6 commits into from
Nov 12, 2024

Conversation

acouch
Copy link
Collaborator

@acouch acouch commented Nov 4, 2024

Summary

Fixes #2622

Time to review: 5 mins

Changes proposed

Add ISR for opp pages.

Testing locally

  1. running npm run build && npm run start
  2. Opp page loads should be faster after a refresh: [Issue #2622] Update opp page for ISR #2724 (review)
  3. Opp pages should have a cache control header that is compatible with a reverse proxy/CDN:
    image
  4. Opp page loads don't touch the API after the page is cached
  5. Change a value in the database for that opportunity or turn off the API completely. The opportunity should reload for 10 mins and then not.

@acouch acouch changed the title Update opp page for ISR [Issue #2622] Update opp page for ISR Nov 4, 2024
@acouch acouch marked this pull request as ready for review November 7, 2024 17:34
Copy link
Collaborator

@doug-s-nava doug-s-nava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love the added testing here. Not sure how I should be testing locally though. Here is what I'm seeing on load times if we want to base the AC on that. FWIW particularly on the production build it seems to be an improvement over the current timings

  • main npm run dev (1st load, and refresh)
Screenshot 2024-11-12 at 9 51 25 AM Screenshot 2024-11-12 at 9 52 09 AM
  • main (npm run build && npm start)
    Screenshot 2024-11-12 at 10 19 34 AM

Screenshot 2024-11-12 at 10 19 46 AM

  • this branch (1st load and refresh)
    Screenshot 2024-11-12 at 10 08 59 AM
    Screenshot 2024-11-12 at 10 09 08 AM

  • this branch (npm run build && npm start)
    Screenshot 2024-11-12 at 10 14 50 AM
    Screenshot 2024-11-12 at 10 15 16 AM

@@ -41,6 +42,10 @@ export async function generateMetadata({ params }: { params: { id: string } }) {
return meta;
}

export function generateStaticParams() {
return [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so this seems to be the configuration that this change sets up:

  • no pages are built and pre-cached at build time
  • all pages are rendered the on their first hit within a 10 minute window, then cached for 10 minutes

Is that right? Is the idea to try this out and evaluate how it works, or are there plans for next steps, such as as generating a list of all current opportunities at build time and pre-caching? Is the 10 minute window a ballpark estimate at this point that we will analyze in some way after launch and adjust, or is that based on data that leads us to believe it should be a pretty solid permanent setting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that right? Is the idea to try this out and evaluate how it works, or are there plans for next steps, such as as generating a list of all current opportunities at build time and pre-caching?

Yes. We could certainly to that in the future. We don't have a good way of getting all of the opp ids. We might want an API for that in the future.

Is the 10 minute window a ballpark estimate at this point that we will analyze in some way after launch and adjust, or is that based on data that leads us to believe it should be a pretty solid permanent setting?

The file links refresh every 30 mins, so that is the higher end. The 10 mins is something we can test and adjust in the future.

@@ -127,5 +136,3 @@ async function OpportunityListing({ params }: { params: { id: string } }) {
</div>
);
}

export default withFeatureFlag(OpportunityListing, "showSearchV0");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we merge, worth noting in the commit that this change is also included in case anyone wants to track it down later

Copy link
Collaborator

@doug-s-nava doug-s-nava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ ✅ ✅ ✅

@acouch acouch merged commit 2fb61a6 into main Nov 12, 2024
11 checks passed
@acouch acouch deleted the acouch/opp-page-isr branch November 12, 2024 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Incremental Static Regeneration (ISR) for opportunity pages by adding generateStaticParams()
2 participants