Skip to content

fix: Handle undefined signupSources gracefully - #1274

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/undefined-signup-sources
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/undefined-signup-sources

Conversation

@sentry

@sentry sentry Bot commented Sep 15, 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 at runtime, despite being typed as a non-null array in the schema and types.

The root cause was that the optional chain user?. only guarded against user being nullish, not against signupSources itself being undefined (likely due to legacy user data or serialization issues).

The fix involves a two-pronged approach:

  1. Client-side (src/components/NewsletterSignup.tsx): Added optional chaining (?.) to signupSources to prevent the client-side crash when calling .includes.
  2. Server-side (src/auth/auth.server.ts, src/utils/users.server.ts): Implemented nullish coalescing (?? []) when reading signupSources from the database. This ensures that signupSources is always an array ([]) for all downstream consumers, preventing similar TypeErrors in other parts of the application and enforcing the contract at the data retrieval layer.

Fixes TANSTACK-COM-4FJ

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 15, 2026 11:03
@coderabbitai

coderabbitai Bot commented Sep 15, 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: f5ea09d9-0006-409a-b745-77626837bd1e

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 15, 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 b2237df Commit Preview URL

Branch Preview URL
Sep 15 2026, 11:05 AM

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