TypeError: Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element'. in `monitorResize`
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- javascript, react
- 领域
- frontend
调研方向
从 util.js 中的 monitorResize 开始,检查来自 Align.js:110 的调用;重现 issue 中描述的悬停交互,并确认传递给 ResizeObserver.observe 的值。完成标准是悬停路径不再引发报告的 TypeError;issue 中没有指定测试文件。
由索引模型根据 Issue 内容生成。
描述
The following error happens when hovering an element.
See video: https://youtu.be/-aLHvTHvp7Q
TypeError: Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element'.
at ft (util.js:58)
at Align.js:110
at Oi (react-dom.production.min.js:262)
at KqkS.t.unstable_runWithPriority (scheduler.production.min.js:18)
at jl (react-dom.production.min.js:122)
at Ti (react-dom.production.min.js:261)
at pi (react-dom.production.min.js:243)
at react-dom.production.min.js:123
at KqkS.t.unstable_runWithPriority (scheduler.production.min.js:18)
at jl (react-dom.production.min.js:122)
at Hl (react-dom.production.min.js:123)
at $l (react-dom.production.min.js:122)
at De (react-dom.production.min.js:292)
at react-dom.production.min.js:50
at zr (react-dom.production.min.js:105)
at Zt (react-dom.production.min.js:75)
at Jt (react-dom.production.min.js:74)
at KqkS.t.unstable_runWithPriority (scheduler.production.min.js:18)
at Gt (react-dom.production.min.js:73)
at HTMLDivElement.o (helpers.js:72)
Unminified code monitorResize:
export function monitorResize(element, callback) {
var prevWidth = null;
var prevHeight = null;
function onResize(_ref) {
var _ref2 = _slicedToArray(_ref, 1)
, target = _ref2[0].target;
if (!document.documentElement.contains(target))
return;
var _target$getBoundingCl = target.getBoundingClientRect()
, width = _target$getBoundingCl.width
, height = _target$getBoundingCl.height;
var fixedWidth = Math.floor(width);
var fixedHeight = Math.floor(height);
if (prevWidth !== fixedWidth || prevHeight !== fixedHeight) {
// https://webkit.org/blog/9997/resizeobserver-in-webkit/
Promise.resolve().then(function() {
callback({
width: fixedWidth,
height: fixedHeight
});
});
}
prevWidth = fixedWidth;
prevHeight = fixedHeight;
}
var resizeObserver = new ResizeObserver(onResize);
if (element) {
resizeObserver.observe(element); // CRASHES HERE
}
return function() {
resizeObserver.disconnect();
}
;
}
- 主要语言
- TypeScript
- 星标
- 944
- 派生
- 199
- 平均合并
- 19 小时 1 分钟
- 30 天内合并 PR
- 3
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react-component/tooltip 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 64/100
react-component/tooltip#510 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
react-component/tooltip#499 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
react-component/tooltip#488 · 4 条评论 · 2 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 35/100
react-component/tooltip#487 ·
-
难度 3/5 1-2 天 新手友好度 35/100
react-component/tooltip#483 ·
查看 react-component/tooltip 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·