Skip to content

fix: stop VisibilityProxy, Table, IconBar and ContextMenu calling findDOMNode (LAZ-1698) - #24978

Open
ecemooo wants to merge 4 commits into
masterfrom
laz-1698-find-dom-node
Open

ecemooo wants to merge 4 commits into
masterfrom
laz-1698-find-dom-node

Conversation

@ecemooo

@ecemooo ecemooo commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

https://linear.app/nexus-mods/issue/LAZ-1698/clear-the-react-deprecation-warnings-out-of-the-renderer-tests

Summary

Our own components no longer call findDOMNode, which React 19 removes. They use refs instead, and tests now fail if our code calls it again. Nothing changes for users.

  • VisibilityProxy: takes a ref instead of looking up its element. Without a componentClass it now wraps its content in a <div>.
  • Table: gets each row's element from that proxy.
  • IconBar and ContextMenu: get the element their submenus open next to through a ref. react-bootstrap 0.33 doesn't pass refs on, so they hand it a small componentClass that does.
  • Test check: any test where our code calls findDOMNode now fails, naming the caller. react-bootstrap's own calls don't count.

Evidence

  • Before: our code called findDOMNode in 4 places the tests run (VisibilityProxy, Table, IconBar, ContextMenu). React only warned about 2 of them, because it warns once per test file and react-bootstrap's calls hid the rest.
    After: none. All renderer tests pass. A test where our code calls findDOMNode fails; one where react-bootstrap calls it doesn't.
  • In the app, Downloads table, master vs this branch: all rows fill, the arrow keys keep the selected row in view, and the toolbar buttons render the same.

Extension authors: VisibilityProxy now finds its element through a ref. A componentClass that doesn't pass its ref on to a DOM element (a react-bootstrap 0.33 component, or a function component without forwardRef) gets its content wrapped in a <div> inside it, so content still loads as it scrolls into view. Vortex logs a warning naming the class, once. Without a componentClass the content is wrapped in a <div> and Vortex warns once, so don't use it that way inside a <tbody>, a list, a flex or a grid: pass the element as componentClass.

Other findDOMNode calls in our code (Dropdown, ActionDropdown, OverlayTrigger, DraggableList and others) aren't run by any test and are left for later; the check fails a test as soon as one is.

Merge Danger

Door: two-way. Reverting brings back the old calls.

Blast Radius: tables and menus. Rows filling as you scroll, arrow keys in tables, and where icon-bar and right-click submenus open. An extension using VisibilityProxy without a componentClass gets one extra <div> around its content.

@ecemooo ecemooo self-assigned this Nov 19, 2026
@ecemooo ecemooo changed the title fix: stop calling findDOMNode from our own components (LAZ-1698) fix: stop VisibilityProxy, Table, IconBar and ContextMenu calling findDOMNode (LAZ-1698) Nov 19, 2026
@ecemooo
ecemooo marked this pull request as ready for review November 19, 2026 12:02
@ecemooo
ecemooo requested a review from a team as a code owner November 19, 2026 12:02
@ecemooo
ecemooo requested a review from r1chm8 November 19, 2026 15:02
@ecemooo
ecemooo requested a review from r1chm8 November 19, 2026 18:13

@r1chm8 r1chm8 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.

Thanks for working through all of these. I'm treating this as the last round: the two comments below are the only blockers, and I'll approve once they're in without doing another full review. Anything else I spot from here goes into a follow-up ticket rather than this PR.

if (sWarnedComponentClasses.has(componentClass)) {
return;
}
sWarnedComponentClasses.add(componentClass);

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.

This throws if an extension passes componentClass={React.Fragment} (or Suspense, StrictMode, Profiler). Those types are symbols, so they get past the typeof !== "string" check, and WeakSet.add(symbol) throws TypeError: Invalid value used in weak set. They don't take a ref, so they go down the findDOMNode path, and findDOMNode finds the first element of the content, so this line runs on mount and the tree unmounts. Master renders this fine, and Fragment is a likely thing to try, because the no-componentClass warning tells authors to pass one.

Could we only put functions and objects in the WeakSet (typeof componentClass === "function" || typeof componentClass === "object") and keep a plain Set for everything else? A test with componentClass={React.Fragment} would cover it.

// observed node. A report on the detached node says nothing about the content.
if (!this.#inView && node.isConnected) {
if (!this.#inView) {
this.applyVisible(false);

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.

With the node.isConnected guard gone, rows on the findDOMNode path can go blank for good. setElement handles a replaced element on the ref path, but the findDOMNode path only looks for the element again in componentDidUpdate. If a componentClass replaces its root element without the proxy re-rendering (e.g. connect(mapState)(Row) where Row swaps between differently keyed <tr>s on a store change, or Fast Refresh of a plain function), the proxy keeps watching the detached node. The observer reports it out of view, it hides after 1s, and a detached node never comes back into view.

Could we bring back a connected check before hiding, here and in the remaining < 0 branch above? For example, if this.#observed is no longer isConnected, call observeElement() again instead of hiding.

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