[Feat] better console.log behavior for events

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
32/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
frontend, web-dev

Hướng nghiên cứu

Bắt đầu với tài liệu về interactiveLayerIds và sự kiện onClick, sau đó so sánh đối tượng sự kiện của ví dụ cluster chính thức với đầu ra console được mô tả ở đây. Xác định xem hành vi được yêu cầu hay một gợi ý trong tài liệu có phù hợp hay không; được xem là hoàn tất khi thuộc tính features có thể được phát hiện thông qua việc kiểm tra thông thường hoặc tài liệu giải thích rõ cách kiểm tra thuộc tính này.

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

Mô tả

feature
Target Use Case

As a first time user with react-map-gl, when using a map with interactiveLayerIds=[SomeLayer..id] and doing console.log(event) in the onClick EventHandler, you see the following output in console:

Bildschirmfoto 2023-07-23 um 23 10 53

Now you start wondering where the crucial "features" property is and try to fix things in your code. Of course nothing will change whatever you do .Then, after copy/pasting an official example (cluster example) into my codebase and also doing console.log(), you see that its the same there too. Now you realize, that console.log() just doesnt print out the "features" property. The only way to print out this property is the following:

console.log(Object.getOwnPropertyNames(event));

Which gets you this:

Bildschirmfoto 2023-07-23 um 23 21 38

So you fought an error which wasnt one in the first place and thats kind of horrible.

Proposal

Dont know a proposal. Would like to see console.log include this important property when its there. Not a JS pro so i cant even figure out why its not there in the first place. Perhaps something todo with the js prototype property?

What would have helped is a hint in the docs for the interactiveLayerIds=[SomeLayer..id] property so that developers dont search for the resulting "features" property in the event via console.log() which is a quite normal quck and dirty way to inspect stuff. After this, most likely i will start sooner firing up a debugger with a breakpoint

Appendix: thanks for this great library.

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.