Skip to content

Conversation

@williamdalessandro
Copy link
Contributor

@williamdalessandro williamdalessandro commented Oct 29, 2025

πŸ”— Relevant links

πŸ—’οΈ What

This change gives a wrapper to posthog imports used in the Instruqt component that were breaking SSR for the site. Added in SSR tests that will fail if SSR breaks again in the future

🀷 Why

SSR is extremely important for site SEO

πŸ› οΈ How

posthog works off CSR, it's important to have it handled correctly to be rendered after SSR is completed, otherwise it will override the behavior.

  • posthog is "browser only" code. During SSR, a user requests the page and then next js runs the react components to generate html
  • the generated html is sent to the browser and react hydrates the page
  • imports execute immediately when the module loads, so using "import posthog from 'posthog-js' " will still run the CSR code and override SSR

πŸ“Έ Design Screenshots

how the site looks now with JS disabled when before it was a blank white screen:

Screenshot 2025-10-29 at 2 01 10β€―AM

πŸ§ͺ Testing

  • Run the code locally or through the vercel preview.
  • Disable JS in the devtool console (use the command menu to turn off JS)
    • open devtools (CMD + SHIFT + C)
    • open command menu while devtools are open (CMD + SHIFT + P)
    • search for javascript
    • disable javascript and reload the page
  • ensure that the pages still show content

πŸ’­ Anything else?

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@vercel
Copy link

vercel bot commented Oct 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
dev-portal Ready Ready Preview Comment Oct 29, 2025 7:49am

@github-actions
Copy link

github-actions bot commented Oct 29, 2025

πŸ“¦ Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action πŸ€–

This PR introduced no changes to the javascript bundle πŸ™Œ

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.

1 participant