react-component / react-component/util

function inShadow throws error when shadowRoot is undefined

Open
#462 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
670
Forks
205
Avg merge
11d 17h
Merged PRs (30d)
4

Description

I am using latest antd library version 5.8.6 which is dependent on rc-util. There is an edge case where shadowRoot is undefined. When inShadow function is called, the whole page breaks throwing the error below.

VM107071:1 Uncaught TypeError: Right-hand side of 'instanceof' is not an object

It used to work when function returned return getRoot(ele) !== ele?.ownerDocument;

Version: rc-util: 5.37.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the inShadow entry point in rc-util and reproduce the reported call with an undefined shadowRoot. Confirm the change prevents the instanceof error while preserving the prior behavior described in the issue, and verify it with a regression test if an applicable test exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.