Skip to content

fix: NewsletterSignup crashes on undefined signupSources - #1303

Open
sentry[bot] wants to merge 2 commits into
mainfrom
seer/fix/newsletter-signup-undefined-sources
Open

sentry[bot] wants to merge 2 commits into
mainfrom
seer/fix/newsletter-signup-undefined-sources

Conversation

@sentry

@sentry sentry Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a TypeError: Cannot read properties of undefined (reading 'includes') that occurred when user.signupSources was undefined in the NewsletterSignup component.

The root cause was the line user?.signupSources.includes('newsletter') which only guarded against user being undefined, but not user.signupSources.

Changes made:

  • In src/components/NewsletterSignup.tsx, updated line 30 to user?.signupSources?.includes('newsletter') ?? false to safely handle cases where signupSources might be undefined.
  • In src/auth/auth.server.ts, updated the mapDbUserToAuthUser function to ensure signupSources defaults to an empty array (user.signupSources ?? []) when constructing the AuthUser object. This provides a server-side safeguard, though the client-side optional chaining is still necessary for robustness against stale client data or other edge cases.

Fixes TANSTACK-COM-4W6

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry
sentry Bot requested a review from a team September 28, 2026 23:03
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a748b04f-84b6-409d-be4a-23a29812229c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 341504a Commit Preview URL

Branch Preview URL
Sep 28 2026, 11:08 PM

This branch has not been deployed

No deployments
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.

0 participants