Skip to content

Fix Segment children prop-types warning for the Toolbar portal (#97) - #99

Open
reekitconcept wants to merge 1 commit into
mainfrom
kid/fix-toolbar-portal-segment-main
Open

Fix Segment children prop-types warning for the Toolbar portal (#97)#99
reekitconcept wants to merge 1 commit into
mainfrom
kid/fix-toolbar-portal-segment-main

Conversation

@reekitconcept

Copy link
Copy Markdown
Member

Fixes the React warning Invalid prop children supplied to Segment, expected a ReactNode on client-side navigation to the search page. Fixes #97.

createPortal returns a ReactPortal — renderable, but not recognized by the prop-types node checker, so Segment's propTypes flagged it. The portal now renders as a sibling of the Segment inside a fragment; behavior is unchanged (a portal renders into its DOM target regardless of tree position, and Segment provides no context or handlers the subtree would lose).

Port of #98 (feature-ai-rag) to main. The bulk of the diff is prettier reindentation from the fragment wrapper — review with git diff -w (7 insertions, 1 deletion).

Client-side navigation to the search page warned 'Invalid prop
children supplied to Segment, expected a ReactNode': createPortal
returns a ReactPortal, which renders fine but is not recognized by the
prop-types node checker. Render the portal as a sibling of the Segment
(a portal renders into its DOM target regardless of tree position;
Segment provides no context or handlers the subtree would lose).

Port of the feature-ai-rag fix to main. Indentation-only changes are
prettier reindent after wrapping in a fragment - review with
'git diff -w' (7 insertions, 1 deletion).
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.

React warning: Toolbar portal as Segment children fails prop-types on client navigation

1 participant