Skip to content

fix: FollowupPanel input submission bug#516

Merged
ngoiyaeric merged 1 commit intomainfrom
jules-14276778018306632149-b228ac8b
Feb 13, 2026
Merged

fix: FollowupPanel input submission bug#516
ngoiyaeric merged 1 commit intomainfrom
jules-14276778018306632149-b228ac8b

Conversation

@ngoiyaeric
Copy link
Collaborator

@ngoiyaeric ngoiyaeric commented Feb 13, 2026

Fixed a bug where the follow-up question input in the FollowupPanel component failed to submit correctly.

The issue was caused by using the native FormData constructor with the form element, which often fails to capture the current value of controlled React components.

Changes:

  • Updated handleSubmit in components/followup-panel.tsx to explicitly create a new FormData() and append the input state value.
  • Replaced Date.now() with nanoid() for message ID generation to maintain consistency with the rest of the codebase.
  • Verified the fix with a successful bun run build.

PR created automatically by Jules for task 14276778018306632149 started by @ngoiyaeric

Summary by CodeRabbit

  • Refactor
    • Improved internal form data handling and message identification mechanisms in the follow-up panel component to enhance reliability and maintainability.

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link
Contributor

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
qcx Ready Ready Preview, Comment Feb 13, 2026 1:13pm

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

Walkthrough

The followup panel component was refactored to improve form data handling and identifier generation. Form data construction now explicitly appends the input value using a standard key instead of relying on event target data. User message identifiers switched from timestamp-based to UUID-based generation via nanoid.

Changes

Cohort / File(s) Summary
Form Data & ID Generation Refactor
components/followup-panel.tsx
Modified form data construction to explicitly create and append input value with "input" key. Changed user message ID generation from Date.now() to nanoid() with corresponding import addition.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A followup panel, refined with care,
Form data flows with precision rare,
Nanoid replaces time's old way,
Unique identifiers dance and play! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: FollowupPanel input submission bug' directly and clearly describes the main change—fixing an input submission bug in the FollowupPanel component, which aligns with the changeset's primary purpose.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jules-14276778018306632149-b228ac8b

No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af86c6b and 260262d.

📒 Files selected for processing (1)
  • components/followup-panel.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
components/followup-panel.tsx (4)
lib/actions/chat.ts (2)
  • updateDrawingContext (165-205)
  • msg (119-127)
components/chat.tsx (1)
  • id (96-104)
app/page.tsx (1)
  • Page (9-18)
lib/actions/chat-db.ts (1)
  • msg (117-121)
🔇 Additional comments (3)
components/followup-panel.tsx (3)

11-11: LGTM — nanoid import aligns with codebase convention.

Consistent with app/page.tsx which also imports and uses nanoid from @/lib/utils for ID generation.


19-31: Fix is correct — explicitly constructing FormData from React state avoids the controlled-input bug.

One minor note: after this change, the name="input" attribute on the <Input> element (Line 50) is no longer used for FormData construction. It's still fine for semantics/accessibility, but worth being aware that the FormData key "input" is now solely determined by Line 22, not by the element's name prop. If someone later renames one but not the other, they'd silently diverge.


24-28: Good improvement — nanoid() is collision-resistant and type-consistent with the rest of the codebase.

Date.now() produced a number and could collide under rapid submissions; nanoid() produces a unique string matching the ID convention used elsewhere (e.g., app/page.tsx, DB message records).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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 and usage tips.

Copy link

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix aligns with how controlled React inputs should be submitted, but handleSubmit still allows whitespace-only submissions, which can generate empty messages and unnecessary submit calls. There’s also a minor quoting inconsistency ("input") that can be cleaned up for consistency.

Additional notes (1)
  • Maintainability | components/followup-panel.tsx:21-26
    The key name "input" is now hardcoded here. If the server action expects a specific field name, this is fine, but it increases the chance of client/server drift vs. using a shared constant (or deriving the field name from the actual <Input name=...> when possible). Consider centralizing the field key so future refactors don’t silently break submission.
Summary of changes

What changed

  • Updated FollowupPanel form submission to build FormData manually via new FormData() and formData.append('input', input) instead of new FormData(event.currentTarget).
  • Swapped user message ID generation from Date.now() to nanoid() for consistency.
  • Added nanoid import from @/lib/utils.

Files touched

  • components/followup-panel.tsx

Comment on lines 19 to 28
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
const formData = new FormData(event.currentTarget as HTMLFormElement)
const formData = new FormData()
formData.append("input", input)

const userMessage = {
id: Date.now(),
id: nanoid(),
isGenerating: false,
component: <UserMessage content={input} />
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual FormData construction fixes the controlled-input issue, but this handler currently trusts input as-is. If the user submits whitespace, you’ll append an empty/meaningless message and still call submit, which can create confusing UX and unnecessary server work. Consider trimming and early-returning (or disabling submit) when empty.

Suggestion

Trim and guard against empty submissions before building messages / calling submit:

const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
  event.preventDefault()

  const value = input.trim()
  if (!value) return

  const formData = new FormData()
  formData.append('input', value)

  const userMessage = {
    id: nanoid(),
    isGenerating: false,
    component: <UserMessage content={value} />
  }
  // ...
}

Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion.

@charliecreates charliecreates bot removed the request for review from CharlieHelps February 13, 2026 13:17
@ngoiyaeric ngoiyaeric merged commit 6691d10 into main Feb 13, 2026
4 of 5 checks passed
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