Skip to content

fix(flow-react): render React adapter once when moved while connecting#24661

Open
totally-not-ai[bot] wants to merge 3 commits into
mainfrom
fix/react-adapter-double-render-in-dialog
Open

fix(flow-react): render React adapter once when moved while connecting#24661
totally-not-ai[bot] wants to merge 3 commits into
mainfrom
fix/react-adapter-double-render-in-dialog

Conversation

@totally-not-ai

Copy link
Copy Markdown
Contributor

A ReactAdapterElement placed inside a dialog was rendered twice. When a
dialog opens it attaches the adapter element and then immediately moves it
in the DOM (disconnect + reconnect) within the same task. Each connect
dispatches a 'flow-portal-add' event, and Flow schedules a React portal for
it. The matching 'flow-portal-remove' listener was attached from an effect
inside FlowPortal, which only runs after React commits the portal. Because
the element was moved before that commit, the 'flow-portal-remove' event
dispatched on disconnect was lost, the first portal was never removed, and
the reconnect added a second portal targeting the same element.

Register the removal listener synchronously while handling the
'flow-portal-add' event so the removal is never missed, regardless of when
React commits the portal.

Fixes #24660

A ReactAdapterElement placed inside a dialog was rendered twice. When a
dialog opens it attaches the adapter element and then immediately moves it
in the DOM (disconnect + reconnect) within the same task. Each connect
dispatches a 'flow-portal-add' event, and Flow schedules a React portal for
it. The matching 'flow-portal-remove' listener was attached from an effect
inside FlowPortal, which only runs after React commits the portal. Because
the element was moved before that commit, the 'flow-portal-remove' event
dispatched on disconnect was lost, the first portal was never removed, and
the reconnect added a second portal targeting the same element.

Register the removal listener synchronously while handling the
'flow-portal-add' event so the removal is never missed, regardless of when
React commits the portal.

Fixes #24660
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Test Results

 1 456 files  ±0   1 456 suites  ±0   1h 39m 59s ⏱️ +10s
10 308 tests +2  10 240 ✅ +2  68 💤 ±0  0 ❌ ±0 
10 780 runs  +2  10 711 ✅ +2  69 💤 ±0  0 ❌ ±0 

Results for commit d13a5c5. ± Comparison against base commit b82e452.

♻️ This comment has been updated with latest results.

Condense the explanatory comment for the synchronous flow-portal-remove
listener to match the surrounding code style. No behavior change.
@Artur- Artur- requested a review from platosha June 17, 2026 06:49
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React component is rendered twice in dialog when using Vaadin 25

1 participant