-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Get GitHub file contributors during getStaticProps, cache to avoid rate limit #12942
Conversation
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
run `yarn` automatically on `yarn dev` or `yarn build` to 1- update dependencies if needed, 2- trigger the `postinstall` script which will now remove the git-contributor-cache.json file to start the environment fresh each time
d1a3b96
to
ea4fcba
Compare
@@ -206,6 +204,7 @@ type DocsLayoutProps = Pick< | |||
| "lastUpdatedDate" | |||
| "crowdinContributors" | |||
| "contentNotTranslated" | |||
| "gitContributors" |
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.
Note that gitContributors
and creowdinContributors
will be deprecated in #12969 in favor of a single list of contributors
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.
LGMT! good job @wackerow
@@ -8,13 +8,11 @@ import { | |||
ListItem, | |||
ModalBody, | |||
ModalHeader, | |||
SkeletonText, |
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.
bye bye 💀 oh much cleaner now
response.status === 403 && | ||
response.headers.get("X-RateLimit-Remaining") === "0" | ||
) { | ||
const resetTime = response.headers.get("X-RateLimit-Reset") as 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.
Nice use of headers for this, TIL
Description
Updates fetching for GitHub contributors for each page, removing the client-side fetch, replacing with cached solution during getStaticProps (server-side), removing all error/loading conditionals allowing the component the render immediately.
useClientSideGitHub*
hooksfetchGitHistory.ts
script, designed to be run server-side during getStaticProps[...slug].tsx]
page component that stores already fetched data.getStaticProps
, and passed forward. Updated consuming components to remove all conditionals, as this data should never be in a loading or error state anymore.isDesktop
boolean inside FileContributors and replaced withhideBelow="md"
to fix the initial patch render glitch where this component was empty to start.Preview URL