supermemory/apps/web/components/document-cards
vimzh e5ead50a3d fix(tweet-preview): guard JSON.parse to avoid crashing on malformed tweet data
TweetPreview was passing the result of `JSON.parse(data)` straight into
`enrichTweet` whenever `data` was a string. If a document's stored tweet
metadata was ever a non-JSON string, truncated JSON, or `"null"` / `"123"`,
the unguarded parse threw and crashed the React tree rendering the
document modal or memory card.

Extract the parse into a `parseTweetData` helper that returns `null` when
the input is missing, fails to parse, or doesn't resolve to an object.
TweetPreview now renders nothing in those cases instead of crashing.

Also widen the prop type from `Tweet` to `Tweet | string` to reflect the
runtime input both call sites already pass.
2026-05-24 11:46:19 +05:30
..
file-preview.tsx chore: improve the codebase with react doctor (#917) 2026-05-09 19:12:01 +00:00
google-docs-preview.tsx chore: improve the codebase with react doctor (#917) 2026-05-09 19:12:01 +00:00
mcp-preview.tsx fix: Add plugin document rendering and MCP preview support (#938) 2026-05-15 18:26:37 +00:00
note-preview.tsx fix: Add plugin document rendering and MCP preview support (#938) 2026-05-15 18:26:37 +00:00
notion-preview.tsx chore: improve the codebase with react doctor (#917) 2026-05-09 19:12:01 +00:00
plugin-preview.tsx fix: Add plugin document rendering and MCP preview support (#938) 2026-05-15 18:26:37 +00:00
tweet-preview.tsx fix(tweet-preview): guard JSON.parse to avoid crashing on malformed tweet data 2026-05-24 11:46:19 +05:30
website-preview.tsx chore: improve the codebase with react doctor (#917) 2026-05-09 19:12:01 +00:00
youtube-preview.tsx chore: improve the codebase with react doctor (#917) 2026-05-09 19:12:01 +00:00