[Bug] Event listener on map initialized by defaultBounds causes warning in console
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- react, typescript
调研方向
先复现提供的 Map 示例,然后检查 createMapEvent 附近的 use-map-events.ts,以及堆栈跟踪中所示 fitBounds 调用附近的 use-map-instance.ts。当使用 onCenterChanged 初始化 defaultBounds 不再产生控制台警告时,即表示完成;更改后验证该复现。
由索引模型根据 Issue 内容生成。
描述
Description
Warning in console when initializing a map with defaultBounds and adding an event listener:
main.js:169 [createEvent] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new
Steps to Reproduce
import React from 'react';
import {
APIProvider,
Map,
} from '@vis.gl/react-google-maps';
import './App.css';
const API_KEY = '';
const MAP_ID = '';
export default function MyApp() {
return (
<APIProvider apiKey={API_KEY}>
<Map
id="map"
mapId={MAP_ID}
defaultBounds={{north: 45, south: 0, east: 0, west: 45}}
onCenterChanged={() => {console.log('center changed')}}
/>
</APIProvider>
);
}
Environment
- Library version: 1.2.0
- Google maps version: weekly
- Browser and Version: Chrome 129.0.6668.70
- OS: Mint 22
Logs
main.js:169 [createEvent] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new
createMapEvent @ use-map-events.ts:104
(anonymous) @ use-map-events.ts:66
_.nk @ main.js:169
tk @ main.js:170
_.rk.set @ main.js:294
(anonymous) @ main.js:177
d @ map.js:23
iC @ map.js:24
(anonymous) @ main.js:414
Promise.then
fn.fitBounds @ main.js:414
(anonymous) @ use-map-instance.ts:157
commitHookEffectListMount @ react-dom.development.js:23189
commitPassiveMountOnFiber @ react-dom.development.js:24965
commitPassiveMountEffects_complete @ react-dom.development.js:24930
commitPassiveMountEffects_begin @ react-dom.development.js:24917
commitPassiveMountEffects @ react-dom.development.js:24905
flushPassiveEffectsImpl @ react-dom.development.js:27078
flushPassiveEffects @ react-dom.development.js:27023
(anonymous) @ react-dom.development.js:26808
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
Show less
- 主要语言
- TypeScript
- 星标
- 1.9k
- 派生
- 195
- 平均合并
- 2 天 11 小时
- 30 天内合并 PR
- 14
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
visgl/react-google-maps 的其他 Issue
-
bug needs more info
难度 3/5 1-2 天 新手友好度 45/100
visgl/react-google-maps#1039 · 1 条评论 ·
维护者通常 2 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 35/100
visgl/react-google-maps#918 · 9 条评论 ·
维护者通常 2 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 45/100
visgl/react-google-maps#905 ·
维护者通常 2 天内回复
-
google maps issue
难度 3/5 1-2 天 新手友好度 45/100
visgl/react-google-maps#889 · 1 条评论 ·
维护者通常 2 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 35/100
visgl/react-google-maps#884 · 1 条评论 ·
维护者通常 2 天内回复
查看 visgl/react-google-maps 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
supabase/agent-skills#611 ·
-
难度 1/5 1 小时以内 新手友好度 68/100
polka-codes/test#345 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 92/100
GoogleChromeLabs/project-sesame#217 ·
维护者通常 12 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
solana-foundation/solana-com#2202 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100