[Bug] Map is distorted when reuseMaps is true

Đang mở
#2,578 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
react, typescript
Lĩnh vực
frontend, web-dev

Hướng nghiên cứu

Bắt đầu với bản tái hiện CodeSandbox được liên kết bằng [email protected] và Map library 3.18.0; thêm token Mapbox bắt buộc và thực hiện theo đường dẫn unmount/remount của reuseMaps sau khi pan và zoom. So sánh việc hiển thị bản đồ trước và sau remount, sau đó xác minh rằng việc chuyển đổi lặp lại không còn làm biến dạng bản đồ hoặc ngăn các tile tải xuống.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Description

The map renders correctly on the initial load (see Image 1). However, the map becomes distorted or fails to load tiles properly (see Image 2) when the component is unmounted and remounted while the reuseMaps property is enabled. It appears as though the map container dimensions or tile coordinates are not being recalculated correctly upon re-insertion into the DOM.

The issue can be reproduced here (the mapbox token need to add): https://codesandbox.io/p/sandbox/reactjs-playground-forked-n5nfrk

Image Image
Expected Behavior

The map must work well even after remount with reuseMap as true

Steps to Reproduce
  • Load the map and perform pan (drag) and zoom actions.
  • Click the "Toggle Map" button to unmount the component.
  • Click the "Toggle Map" button again to remount the component.
  • Observe the distorted map. (Note: If it doesn't happen immediately, repeat the steps 2-3 times, ensuring you interact with the map between toggles).

The issue can be reproduced here (the mapbox token need to add): https://codesandbox.io/p/sandbox/reactjs-playground-forked-n5nfrk

Environment
Logs

No response

Ngôn ngữ chính
TypeScript
Star
8.5k
Fork
1.3k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của visgl/react-map-gl

Tất cả issue của visgl/react-map-gl

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.