[Bug] zoom value causing type warning when using Amazon Location Service map

未关闭
#2,541 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
aws, react, typescript
领域
frontend, web-dev

调研方向

先从 Map 组件的 initialViewState zoom 处理和 Amazon Location Service 地图样式开始,然后跟踪报告中的 loadTile 和 evaluate 堆栈条目。使用数值 zoom 重现类型警告,并验证在 zoom 仍保持设置的情况下警告不再出现。

由索引模型根据 Issue 内容生成。

描述

bug
Description

When I use the maplibre Map with Amazon Location Service as the tile provider I'm getting some type warnings, when passing zoom to initialViewState:

Expected value to be of type number, but found string instead.

import { Map, } from "react-map-gl/maplibre";

...

  return (
      <Map
        initialViewState={{
          longitude: longitude,
          latitude: latitude,
          zoom: 14,
        }}
        mapStyle={`https://maps.geo.eu-central-1.amazonaws.com/v2/styles/Standard/descriptor?key=${amazonApiKey}&color-scheme=Light`}
        attributionControl={false}
        style={{ width: "100%", height: "100%" }}
        onLoad={() => setLoading(false)}
        onError={(e) => {
          console.error("Error loading map:", e);
          setError(true);
        }}
      />
 )

I noticed when I use remove the zoom param or set it to undefined the warning goes away.

Expected Behavior

No type warnings should be happening when passing the zoom property.

Steps to Reproduce

Can't because I don't want to share a amazon location service api key, but using Amazon as the tile provider and then passing the zoom property to the initialViewState will show the warnings all over console.

Environment
  • Framework version: "react-map-gl": "^8.0.4",
  • Map library: "maplibre-gl": "^5.5.0",
  • Browser: Chrome Version 137.0.7151.55 (Official Build) (arm64)
  • OS: Running in Docker Container (node:20-alpine - Linux)
Logs

Stack in the console after (Expected value to be of type number, but found null instead.)

  | evaluate | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
-- | -- | -- | --
  | filter | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | populate | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | (anonymous) | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | (anonymous) | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | e | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | parse | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | (anonymous) | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | a | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | Promise.then |   |  
  | l | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | (anonymous) | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | e | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | loadTile | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | (anonymous) | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | (anonymous) | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | (anonymous) | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | e | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | processTask | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | process | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | (anonymous) | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1
  | MessageChannel._channel.port2.onmessage | @ | 1f28c7d8-fa56-4e41-85f9-18854632164e:1


主要语言
TypeScript
星标
8.5k
派生
1.3k
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

visgl/react-map-gl 的其他 Issue

查看 visgl/react-map-gl 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。