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

Stabilize HTML build outputs #826

Merged
merged 2 commits into from
Dec 16, 2022

Conversation

fturmel
Copy link
Collaborator

@fturmel fturmel commented Dec 9, 2022

Some additional improvements to build/deploy performance.

It's been bothering me that the Netlify build often needs to redeploy thousands of files for no apparent reason after merging PRs that often don't change much. I've been diffing build outputs to understand why.

  • the react-select component library increments element ids internally by default. This is causing a problem because Gatsby builds using parallel worker threads that execute in an unpredictable order, so a page will very likely end up with a different select component id between each build. Explicitly setting the instanceId prop fixes the problem.
    https://github.com/JedWatson/react-select/blob/c350a124f8de853a79e0158578d438a35e67e63e/packages/react-select/src/Select.tsx#L638-L639

  • the TopBar component that displays today's date is captured in HTML during the build phase. It creates some visual flickering because the date in the markup is often not the same as after hydration. It also forces every HTML page to be redeployed on a new build if the last build didn't happen on the same date (UTC). This PR only displays the date after React hydration to address the problem.

topbar-date-flicker.mp4

Screenshot 2022-12-09 at 9 44 41 AM

@netlify
Copy link

netlify bot commented Dec 9, 2022

Deploy Preview for codingtrain ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 15267aa
🔍 Latest deploy log https://app.netlify.com/sites/codingtrain/deploys/6393521d6a2f6000088a7b96
😎 Deploy Preview https://deploy-preview-826--codingtrain.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@shiffman
Copy link
Member

I've checked this through and the deploy preview seems to be working great! Tagging @runemadsen just as an FYI, but I'm going to go ahead and merge!

@shiffman shiffman merged commit 8966474 into CodingTrain:main Dec 16, 2022
@fturmel fturmel deleted the PR/stabilize-build-outputs branch December 17, 2022 01:15
@runemadsen
Copy link
Contributor

Lovely!

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

Successfully merging this pull request may close these issues.

3 participants