Skip to content

Fix: Guard HyperBot follow-up messages against null API response - #210

Merged
kevinhermawan merged 2 commits into
mainfrom
fix/hyperbot-followup-null
Nov 11, 2026
Merged

kevinhermawan merged 2 commits into
mainfrom
fix/hyperbot-followup-null

Conversation

@dennypradipta

Copy link
Copy Markdown
Collaborator

hyperjump.tech Pull Request

What does this PR solve?

  • The HyperBot chat widget (visible on /en/oneai and other landing pages) crashed with Uncaught TypeError: Cannot read properties of null (reading 'length') right after sending a message.
  • This happened when the follow-up suggestions webhook returned a 200 response with data: null (or no data key), leaving the followUpMessages state as null.

How does this PR solve this problem?

  • fetchFollowUpMessages now returns data.data ?? [], matching the existing null-safe pattern used by fetchPreviousMessages.
  • The render condition is also hardened to (followUpMessages ?? []).length > 0 as a defense-in-depth guard.

How to test this PR?

  • Open any page with the HyperBot widget (e.g. /en/oneai) and start a chat.
  • Send a message and let it complete; the follow-up suggestions section should either render normally or be skipped when the API returns no suggestions — no console crash.
  • Optionally stub the follow-up webhook to return { data: null } and verify the widget still renders fine.

Are there any screenshots/videos?

None

@kevinhermawan
kevinhermawan merged commit 4272d34 into main Nov 11, 2026
11 checks passed
@dennypradipta
dennypradipta deleted the fix/hyperbot-followup-null branch November 11, 2026 04:41
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.

2 participants