fix: dashboard crash (React #130) when an account has an unknown platform - #6
Merged
Conversation
The API can return account/post platforms outside our hardcoded map (whatsapp, discord, sms, phone, rcs, and the ads platforms). The platformIcons lookup then yielded undefined and React threw error #130, crashing the dashboard behind the error boundary. PlatformIcon now falls back to a generic globe, and name/color lookups for API-provided platform strings go through getPlatformName / getPlatformColor with sensible fallbacks. Fixes #5 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Users with accounts on platforms latewiz doesn't map (WhatsApp, Discord, ads accounts, sms/phone/rcs) hit React error #130 on the dashboard:
platformIcons[platform]returnedundefinedand rendering it as a JSX element crashed the section behind the error boundary.Fixes #5
What
PlatformIconfalls back to a generic globe icon when the platform isn't in the icon mapgetPlatformName/getPlatformColorhelpers with fallbacks (capitalized name, neutral gray), used everywhere API-provided platform strings are rendered (dashboard, accounts page, account cards)Verified by rendering
PlatformIconwithwhatsapp,metaads,discordviarenderToString: crashed before, renders the fallback after.tsc --noEmitand lint clean.🤖 Generated with Claude Code