[ Map, Marker ] WebGL Uncaught Error: Not initialized. - Next js
@wangela 已經在處理了。
開始於 2023年3月20日。
評估
這個 Issue 還沒有評估資料。
描述
Thanks for stopping by to let us know something could be better!
PLEASE READ
If you have a support contract with Google, please create an issue in the support console. This will ensure a timely response.
Discover additional support services for the Google Maps Platform, including developer communities, technical guidance, and expert support at the Google Maps Platform support resources page.
If your bug or feature request is not related to this particular library, please visit the Google Maps Platform issue trackers.
Check for answers on StackOverflow with the google-maps tag.
Please be sure to include as much information as possible:
Environment details
- Specify the API at the beginning of the title (for example, "Places: ...")
- OS type and version
- Library version and other environment information
Steps to reproduce
- Refresh
Code example
_app.tsx
<Wrapper
apiKey={process.env.NEXT_PUBLIC_GOOGLE_MAP_API_KEY as string}
version={"beta"}
libraries={["marker"]}
>
<RecoilRoot>
<QueryClientProvider client={queryClient}>
<AuthWrapper {...props} />
</QueryClientProvider>
</RecoilRoot>
</Wrapper>
some_page.tsx
<Map
style={{ width: "100%", height: "calc(100vh - 56px - 48px)" }}
center={{ lat: 37.541, lng: 126.986 }}
zoom={10}
disableDefaultUI={true}
zoomControl={true}
gestureHandling="greedy"
mapId={"ffd73acbe75007f4"}
>
<MapMarker
position={{ lat: 37.541, lng: 126.986 }}
title={"Pin"}
onClick={(marker, latLng) => console.info(marker, latLng)}
/>
</Map>
</div>
Map.tsx
import { useDeepCompareEffectForMaps } from "@/hooks/useDeepCompareEffectForMaps";
import React from "react";
import useDeepCompareEffect from "use-deep-compare-effect";
type MapProps = {
style: { [key: string]: string };
onClick?: (e: google.maps.MapMouseEvent) => void;
onIdle?: (map: google.maps.Map) => void;
} & google.maps.MapOptions &
React.PropsWithChildren;
const Map = ({ onClick, onIdle, children, style, ...options }: MapProps) => {
const ref = React.useRef<HTMLDivElement>(null);
const [map, setMap] = React.useState<google.maps.Map>();
React.useEffect(() => {
if (ref.current && !map) {
setMap(new window.google.maps.Map(ref.current, options));
}
}, [ref, map]);
useDeepCompareEffectForMaps(() => {
if (map) {
map.setOptions(options);
}
}, [map, options]);
React.useEffect(() => {
if (map) {
["click", "idle"].forEach((eventName) =>
google.maps.event.clearListeners(map, eventName)
);
if (onClick) {
map.addListener("click", onClick);
}
if (onIdle) {
map.addListener("idle", () => onIdle(map));
}
}
}, [map, onClick, onIdle]);
// [END maps_react_map_component_event_hooks]
// [START maps_react_map_component_return]
return (
<>
<div ref={ref} style={style} />
{React.Children.map(children, (child) => {
if (React.isValidElement(child)) {
// set the map prop on the child component
// @ts-ignore
return React.cloneElement(child, { map });
}
})}
</>
);
};
export default Map;
Stack trace
Uncaught Error: Not initialized.
at aZ (webgl.js:182:509)
at D8a.wj (webgl.js:965:13)
at C8a.wj (webgl.js:551:262)
at B8a.m (webgl.js:552:228)
at Sla (map.js:18:28)
at Rla (map.js:19:203)
at Ru (map.js:16:496)
at Object.Lj (map.js:62:233)
at HTMLDivElement.<anonymous> (common.js:210:701)
Following these steps will guarantee the quickest resolution possible.
Thanks!
- 主要語言
- TypeScript
- 星號
- 381
- 分支
- 50
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
googlemaps/react-wrapper 的其他 Issue
-
triage me type: feature request
難度 3/5 1-2 天 新手友好度 35/100
googlemaps/react-wrapper#839 ·
-
priority: p1 type: bug
難度 2/5 1-3 小時 新手友好度 35/100
googlemaps/react-wrapper#782 · 3 則留言 · 4 個 reaction ·
-
customize map style可能重新可做 @wangela 於 1277 天前認領,目前沒有進行中的 PR。 未關閉triage me type: feature request
googlemaps/react-wrapper#667 · 4 則留言 · 已指派 1 人 ·
-
How to mock <Wrapper /> ?可能重新可做 @wangela 於 1298 天前認領,目前沒有進行中的 PR。 未關閉type: question
googlemaps/react-wrapper#656 · 5 則留言 · 4 個 reaction · 已指派 1 人 ·
-
Markers flicker when scrolling on the map, React 18可能重新可做 @wangela 於 1330 天前認領,目前沒有進行中的 PR。 未關閉
googlemaps/react-wrapper#642 · 9 則留言 · 15 個 reaction · 已指派 1 人 ·
查看 googlemaps/react-wrapper 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
complexity:simple priority:P3 ready-to-build
難度 2/5 1-3 小時 新手友好度 76/100
junruxiong/IncarnaMind#2919 ·
-
難度 2/5 1-3 小時 新手友好度 65/100
radiancelux/prgenie#204 ·
維護者通常 1 天內回覆
-
bug documentation
難度 2/5 1-3 小時 新手友好度 83/100
cqframework/vscode-cql#198 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
WalletConnect/walletconnect-monorepo#7392 · 1 則留言 ·