react-component / react-component/resize-observer

文本节点通过observe监听报类型错误

Open
#144 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
201
Forks
47
PR merge metrics
No merged PRs in 30d

Description

<ResizeObserver onResize={onResize} disabled={disabled}>
          <Wrapper>
            11
            <textarea ref={textareaRef} placeholder="I'm a textarea!" />
          </Wrapper>
</ResizeObserver>

如果传入文本节点 通过findDOMNode获取到的是nodeType为3的节点,通过调用observe(currentElement, onInternalResize); 传入类型不匹配导致报错,还有就是如果传入() => <div>11</div> 函数渲染的话,通过findDOMNode找不到被监听的函数

我从antd里的Affix中发现的问题 最后定位到这了。

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

Reproduce the reported cases from the issue: a text node passed to ResizeObserver and a function-rendered element. Trace how findDOMNode results are passed to observe; done means text nodes no longer cause a type error and function-rendered elements are handled or clearly rejected without an invalid observation attempt.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.