Skip to content

fix(ui-motion): use elementRef instead of ref in BaseTransition renderChildren#2514

Open
Gazuru wants to merge 1 commit intomasterfrom
LX-4014-fix-ref-is-not-a-prop
Open

fix(ui-motion): use elementRef instead of ref in BaseTransition renderChildren#2514
Gazuru wants to merge 1 commit intomasterfrom
LX-4014-fix-ref-is-not-a-prop

Conversation

@Gazuru
Copy link
Copy Markdown
Collaborator

@Gazuru Gazuru commented Apr 14, 2026

Replace the deprecated ref callback with elementRef and remove the now-redundant findDOMNode wrapper, since elementRef receives the DOM element directly from InstUI children.

renderChildren now distinguishes between HTML elements and components: HTML elements receive a ref callback (which gives the DOM element directly), while components receive elementRef (the InstUI convention). This removes findDOMNode without breaking non-InstUI children like plain <div> or <span>. The test's ExampleComponent was updated from a class component to a functional component that supports elementRef.

Fixes LX-4024.

@Gazuru Gazuru requested review from joyenjoyer and matyasf April 14, 2026 10:15
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2514/

Built to branch gh-pages at 2026-04-14 11:48 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@Gazuru Gazuru marked this pull request as draft April 14, 2026 10:22
@Gazuru Gazuru self-assigned this Apr 14, 2026
@Gazuru Gazuru force-pushed the LX-4014-fix-ref-is-not-a-prop branch from 6464e5e to 83e995a Compare April 14, 2026 11:08
…rChildren

Replace the deprecated ref callback with elementRef and remove the
now-redundant findDOMNode wrapper, since elementRef receives the DOM
element directly from InstUI children.

renderChildren now distinguishes between HTML elements and components:
HTML elements receive a ref callback (which gives the DOM element
directly), while components receive elementRef (the InstUI convention).
This removes findDOMNode without breaking non-InstUI children like
plain <div> or <span>. The test's ExampleComponent was updated from a
class component to a functional component that supports elementRef.
@Gazuru Gazuru force-pushed the LX-4014-fix-ref-is-not-a-prop branch from 83e995a to bc37bd6 Compare April 14, 2026 11:44
@Gazuru Gazuru marked this pull request as ready for review April 14, 2026 11:56
@matyasf matyasf requested review from balzss and removed request for matyasf April 20, 2026 08:53
if (!this.props.children) return null

const child = ensureSingleChild(this.props.children) as ReactElement
const isInstUIComponent = !!(child.type as any)?.componentId
Copy link
Copy Markdown
Contributor

@joyenjoyer joyenjoyer Apr 21, 2026

Choose a reason for hiding this comment

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

Not all components have componentId, I believe this is not a reliable way to check if it is an InstUI component or not.

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.

3 participants