Skip to content

fix: guard GoogleOneTapContainer against SSR window access - #17567

Merged
brainbicycle merged 1 commit into
mainfrom
brian/one-tap-cleanup-follow-up
Aug 13, 2026
Merged

fix: guard GoogleOneTapContainer against SSR window access#17567
brainbicycle merged 1 commit into
mainfrom
brian/one-tap-cleanup-follow-up

Conversation

@brainbicycle

Copy link
Copy Markdown
Contributor

The type of this PR is: Fix

Description

Removing the feature flag dropped the short-circuit that previously kept the window.location.pathname check from running during SSR, causing a "window is not defined" 500. Guard the enabled check with a typeof window test so it resolves to false on the server.

Assisted-By: Claude noreply@anthropic.com

Removing the feature flag dropped the short-circuit that previously kept
the window.location.pathname check from running during SSR, causing a
"window is not defined" 500. Guard the enabled check with a typeof
window test so it resolves to false on the server.

Assisted-By: Claude <noreply@anthropic.com>
@brainbicycle brainbicycle self-assigned this Aug 13, 2026
@relativeci

relativeci Bot commented Aug 13, 2026

Copy link
Copy Markdown

#9568 Bundle Size — 9.02MiB (~+0.01%).

9cd1d17(current) vs 914f877 main#9565(baseline)

Warning

Bundle contains 29 duplicate packages – View duplicate packages

Bundle metrics  Change 1 change Regression 1 regression
                 Current
#9568
     Baseline
#9565
Regression  Initial JS 2.94MiB(~+0.01%) 2.94MiB
No change  Initial CSS 0B 0B
No change  Cache Invalidation 97.48% 97.48%
No change  Chunks 111 111
No change  Assets 114 114
No change  Modules 5704 5704
No change  Duplicate Modules 691 691
No change  Duplicate Code 5.05% 5.05%
No change  Packages 248 248
No change  Duplicate Packages 28 28
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#9568
     Baseline
#9565
Regression  JS 8.8MiB (~+0.01%) 8.8MiB
No change  Other 232.77KiB 232.77KiB

Bundle analysis reportBranch brian/one-tap-cleanup-follow-upProject dashboard


Generated by RelativeCIDocumentationReport issue

@claude

claude Bot commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Adds a typeof window !== "undefined" short-circuit to the enabled computation in GoogleOneTapContainer, so the window.location.pathname check no longer runs during SSR. Fixes the "window is not defined" 500 introduced when the feature flag was removed.

Issues Found

None. The guard is placed first in the && chain, so window.location.pathname on line 43 is never reached on the server. The remaining window accesses (lines 47, 57–59, 65) all live inside useEffect, which never runs during SSR, so they need no guard.

Areas Reviewed

  • SSR safety: Correct. enabled resolves to false on the server, the component returns null, and no browser global is touched at render time.
  • Testing: src/Utils/__tests__/GoogleOneTapContainer.jest.tsx already covers the enabled/disabled paths and auth-path behavior. The SSR guard isn't directly exercised, but jsdom always defines window, so a unit test can't meaningfully assert it — CI/runtime is the real check here.

Looks good to merge.

@anandaroop anandaroop left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@brainbicycle
brainbicycle merged commit b83648c into main Aug 13, 2026
17 checks passed
@brainbicycle
brainbicycle deleted the brian/one-tap-cleanup-follow-up branch August 13, 2026 16:11
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