Skip to content

fix: handle invalid shared chat data - #14

Open
xeseing wants to merge 1 commit into
firecrawl:mainfrom
xeseing:fix-invalid-shared-chat-data
Open

fix: handle invalid shared chat data#14
xeseing wants to merge 1 commit into
firecrawl:mainfrom
xeseing:fix-invalid-shared-chat-data

Conversation

@xeseing

@xeseing xeseing commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Handles invalid shared chat data safely when reading the share query parameter.

Changes

  • Added a helper to parse shared chat messages safely
  • Wrapped shared chat decompression and JSON parsing in a try/catch
  • Falls back to an empty conversation when shared data is invalid
  • Validates that parsed shared data is an array before passing it to useChat

Why

A malformed or invalid share query parameter can cause JSON.parse to throw and crash the chatbot. Shared links should fail gracefully instead of breaking the page.

Testing

  • Reviewed src/components/chat.tsx
  • Verified invalid shared chat data falls back to an empty message list
  • Verified valid shared chat data still passes through when parsed as an array

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

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.

1 participant