Skip to content

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Description

Fixes the SignupCTA button loading delay by implementing server-side rendering with client-side hydration. Previously, the button took several seconds to appear due to the BrowserOnly wrapper preventing server-side rendering and requiring client-side Statsig initialization.

Before: SignupCTA button appears with 3-5 second delay after page load
After: SignupCTA button appears immediately on page load, then updates with dynamic config if available

Key Changes

  • Removed @docusaurus/BrowserOnly wrapper to enable server-side rendering
  • Implemented React useState/useEffect pattern for immediate default rendering with client-side hydration
  • Replaced useDynamicConfig hook with direct Statsig client API calls to avoid SSR hooks issues
  • Added proper event listener cleanup to prevent memory leaks
  • Maintained backward compatibility with existing dynamic config functionality

Critical Review Areas

🔍 Please verify:

  • API Key: Hardcoded Statsig client key matches intended usage and doesn't expose sensitive credentials
  • SSR Compatibility: Test that server-side rendering works correctly in production builds
  • Event Cleanup: Verify event listener cleanup logic prevents memory leaks
  • Statsig Integration: Confirm direct window.Statsig usage aligns with codebase patterns vs useDynamicConfig hook
  • Fallback Behavior: Test that "Get Started" fallback works when dynamic config is unavailable

Testing

Locally verified:

  • ✅ SignupCTA button appears immediately on page load
  • ✅ No React hydration errors
  • ✅ Page loads without JavaScript errors
  • ⚠️ Dynamic config behavior needs production verification

Link to Devin run: https://app.devin.ai/sessions/9c870c404972441f9f11793aac78036b
Requested by: @xhuang-statsig

Questions?

Reach out to Brock or Tore on Slack!

- Remove BrowserOnly wrapper to enable server-side rendering
- Show default 'Get Started' button immediately on page load
- Hydrate with dynamic config values on client-side after Statsig loads
- Maintains existing functionality while eliminating loading delay
- Fixes React hydration errors by avoiding hooks during SSR
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@jasonwzm
Copy link
Member

🚀 Deployed on https://68d35775756a6fa25f6e8621--cozy-fox-0defec.netlify.app

@jasonwzm jasonwzm temporarily deployed to pull request September 24, 2025 02:29 Inactive
Copy link
Contributor Author

@U087FSV8F0S @U0872PY4RP0 Could you please review this PR? It fixes the SignupCTA button loading delay by implementing server-side rendering with client-side hydration.

Summary of changes:

  • Removed BrowserOnly wrapper to enable server-side rendering
  • SignupCTA button now appears immediately on page load
  • Still updates with dynamic config from Statsig after initial render
  • All CI checks are passing

The fix has been tested locally and the button now loads instantly instead of taking 3-5 seconds to appear.

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.

2 participants