Skip to content

fix(Chat): ChatToolCalls and ChatDictationButton without a required prop name it and the fix in development - #12420

Closed
josephfarina wants to merge 3 commits into
mainfrom
josephfarina/rl28-chat-missing-props-error
Closed

josephfarina wants to merge 3 commits into
mainfrom
josephfarina/rl28-chat-missing-props-error

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Builds on #12386 (merged), which adds the shared devPropError helper. Review the commits above it.

User impact

Each component below throws a TypeError from deep inside itself (… is not iterable, Cannot read properties of undefined (reading …), … is not a function) when a caller leaves out its required prop. The message names neither the component nor the prop.

Component Required prop
ChatToolCalls calls
ChatDictationButton dictation

Problem and solution fit

Each prop is required by the component's types and its record's public contract, and the component reads it on its first render. In development, each component now checks the prop first and throws an error in Core's Component: message form that names the prop and gives an example, for example:

ChatToolCalls: calls …

Expected behavior and authority

The component records list each prop as part of the public contract; none allows the prop to be omitted. The error uses devPropError from utils/devWarning.ts.

Smallest restoration

  • One inline process.env.NODE_ENV !== 'production' check per component that throws devPropError. A production bundle drops it.

Evidence

  • Reproduction before the change: each render in the test file throws a TypeError from inside the component.
  • Result after the change: in development each render throws the component's message.
  • Representative unchanged path: in production each render throws as before. Minified esbuild production bundles keep their size: ChatToolCalls is byte-identical; ChatDictationButton has the same size and differs only in minified names.
  • Regression test or other mutation-sensitive proof: Chat/Chat.missingProps.test.tsx (development message, the exact production error, and the message is in a development bundle only, per component).

Scope

Components: ChatToolCalls, ChatDictationButton

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

CI=1 vitest run --project ui on each touched component directory plus packages/core/src/utils, tsc -p packages/core, eslint and prettier on the changed files.

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 17, 2026 11:25pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 11:33 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, and it runs once the pull request targets main and is marked ready for review. It lands only after #12386, which adds the devPropError helper this change calls. Both checks follow the components' required-prop contracts: the new message tests fail on the base with the old TypeErrors and pass here, production renders throw exactly as before, and the minified production bundle of ChatToolCalls is byte-identical.

  • Non-blocking: the production test in Chat.missingProps.test.tsx only checks that the render throws something other than the development message, so pinning the TypeError text, as Selector.missingOptions.test.tsx pins options is not iterable, would prove the "throws as before" claim.
Claims and files checked

Review mode: full; reason: no-earlier-review

Claims

  • The base branch adds the shared devPropError helper this change calls: verified.
  • Without its required prop, each component throws a TypeError from inside itself that names neither the component nor the prop: verified on the base (reading 'length' and reading 'isSupported'; the other example forms in the description do not occur for these two).
  • calls and dictation are required by the types and the component records, and each is read on the first render: verified.
  • In development each component checks the prop and throws a Component: message error that names the prop and gives an example: verified by the new tests.
  • The component records allow neither prop to be omitted: verified.
  • The error comes from devPropError in utils/devWarning.ts: verified.
  • One inline development check per component, dropped from a production bundle: verified; the message is absent from both production bundles.
  • Before the change, each render in the test file throws a TypeError: verified; four of the six new tests fail on the base.
  • After the change, each development render throws the component's message: verified.
  • In production each render throws as before: verified for seven inputs on both trees.
  • Production bundles keep their size, with ChatToolCalls byte-identical and ChatDictationButton differing only in minified names: verified.
  • The new test file covers the development message, production behavior and the development-only bundle for each component: verified.
  • One defect, no tagalong, no new public API, visual, default or interaction change, and no internal context: verified; the generated API comparison lists no rows.
  • Tests on the Chat and utils folders, the Core type check, lint and formatting pass: verified (94 files, 1,769 tests).
  • Changeset: in development both components throw an error that names the missing prop and shows the fix, instead of a TypeError: verified.
  • Changeset: production output is unchanged: verified for behavior and bundle size; the ChatDictationButton bundle differs only in minified names.

Files

  • .changeset/chat-missing-props-error.md: clear.
  • packages/core/src/Chat/Chat.missingProps.test.tsx: the non-blocking production-assertion note above.
  • packages/core/src/Chat/ChatDictationButton.tsx: clear.
  • packages/core/src/Chat/ChatToolCalls.tsx: clear.

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet; it runs once the pull request targets main and is marked ready for review. It lands only after #12386, which adds the devPropError helper this change calls. The production tests now pin the exact errors each component threw before, which settles the earlier test note.

  • Miss: non-blocking. The ChatDictationButton message names only useSpeechRecognition(), while the component's JSDoc and block templates pair it with useChatDictation; naming both, and updating the expected message in the test, would point builders to the documented hook.
Claims and files checked

Review mode: incremental; reason: none

  • Changed rules since the last review (0): none.
  • Claim (changeset): in development both components throw an error that names the missing prop and the fix. Verified: the development tests in Chat.missingProps.test.tsx pass on this head.
  • Claim (changeset, description): this replaces a TypeError from inside the component. Verified: the same tests fail on the base with Cannot read properties of undefined (reading 'length') and (reading 'isSupported').
  • Claim (changeset, description): production output is unchanged. Verified: the production tests pin those base errors and pass on base and head; the minified production bundle of ChatToolCalls is byte-identical and ChatDictationButton's keeps its size with only minified names changed.
  • Claim: the change is stacked on #12386, which adds devPropError. Verified: the base is #12386's head, and utils/devWarning.ts exports devPropError.
  • Claim: each prop is required by the types and the component record, and is read on the first render. Verified: ChatToolCalls.tsx:95, :597; ChatDictationButton.tsx:51, :136; both records' public contract.
  • Claim: the error uses Core's Component: message form through devPropError. Verified: ChatToolCalls.tsx:576, ChatDictationButton.tsx:128.
  • Claim: one inline NODE_ENV check per component, which a production bundle drops. Verified: ChatToolCalls.tsx:575, ChatDictationButton.tsx:127, and the bundle tests.
  • Claim: the regression test covers the development message, the exact production error and a development-only bundle message. Verified: 6 tests pass on this head; 4 fail on the base.
  • Claim: no new public API, no tagalong and no internal context. Verified: the built API comparison lists no change, and the diff holds only the two checks, the test and the release note.
  • Claim: vitest on the touched directories and utils, tsc, eslint and prettier pass. Verified on this head.
  • File .changeset/chat-missing-props-error.md: clear.
  • File packages/core/src/Chat/Chat.missingProps.test.tsx: clear.
  • File packages/core/src/Chat/ChatDictationButton.tsx: non-blocking note on the message wording (line 131).
  • File packages/core/src/Chat/ChatToolCalls.tsx: clear.

Automated review (maintainer link)

throw devPropError(
'ChatDictationButton',
'dictation',
'is required: the value of useSpeechRecognition(), for example dictation={dictation}.',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Miss, non-blocking: this names only useSpeechRecognition(), while the component's JSDoc (line 109), the prop docs and both block templates pair it with useChatDictation. Naming both points builders to the documented hook:

'is required: the value of useChatDictation() or useSpeechRecognition(), for example dictation={dictation}.',

The expected message in Chat.missingProps.test.tsx changes with it.

@josephfarina
josephfarina changed the base branch from josephfarina/rl28-selector-options-error to main November 18, 2026 01:33
@josephfarina
josephfarina marked this pull request as ready for review November 18, 2026 02:36
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1e97731

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12072 fix(templates): payment form and checkout wrap the summary below the form on a narrow first paint
  Author: Joey Farina <[email protected]>
- #12274 fix(core): cap the Selector family's trigger-width list minimum at the viewport
  Author: josephfarina <[email protected]>
- #12215 fix(cli): advise keeping one dependency when two packages declare one provider ID
  Author: Joey <[email protected]>
- #12322 [experimental] export --reverse: use the project's own copy of an aliased file, or restore the page's copy with its paths entry
  Author: josephfarina <[email protected]>
- #12403 docs(core): Text's as and PowerSearch's statusVariant list every value their types allow
  Author: Joey Farina <[email protected]>
- #12494 fix(templates): dashboard templates use page sections, not cards, for page regions
  Author: Joey Farina <[email protected]>
- #12282 fix(cli): theme build --check and doctor ignore which CLI release, and which command name, built a theme
  Author: Joey Farina <[email protected]>
- #12420 fix(Chat): ChatToolCalls and ChatDictationButton without a required prop name it and the fix in development
  Author: Joey Farina <[email protected]>
- #12205 fix(cli): equally scored icons put first one whose id the query names in full
  Author: Joey Farina <[email protected]>
- #12455 fix(core): a theme sets the room between a checkbox or a switch and its label
  Author: josephfarina <[email protected]>
- #12658 perf(cli): the first theme build after a CLI upgrade reuses the JavaScript it compiled from a theme's local modules
  Author: Joey <[email protected]>
- #12323 [experimental] export: React logs no render timings while the export draws a page
  Author: Joey Farina <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12713.

@github-actions
github-actions Bot deleted the josephfarina/rl28-chat-missing-props-error branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 1e977317 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant