urbica / react-map-gl

React Component Library for Mapbox GL JS
https://urbica.github.io/react-map-gl/
MIT License
416 stars 50 forks source link

Fix tests and prevent errors when removing the map #527

Open josh-cloudscape opened 1 year ago

josh-cloudscape commented 1 year ago

chore(deps): revert @deck.gl/layers to 8.8.9

This fixes the tests that were failing. It looks like @deck.gl uses dependencies that were converted to esm modules and jest isn't currently set up to handle them.

Jest encountered an unexpected token
...
/home/runner/work/react-map-gl/react-map-gl/node_modules/@deck.gl/layers/node_modules/@mapbox/tiny-sdf/index.js:3
export default class TinySDF {
^^^^^^

SyntaxError: Unexpected token 'export'

Reference: https://github.com/visgl/deck.gl/issues/7735


fix(image): don't add images if map or component is unloaded

Prevents errors when unmounting the map while images are still loading.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 85.71% and project coverage change: -0.25 :warning:

Comparison is base (f58539a) 97.96% compared to head (584e8e0) 97.72%.

:exclamation: Current head 584e8e0 differs from pull request most recent head 36cb600. Consider uploading reports for the commit 36cb600 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #527 +/- ## ========================================== - Coverage 97.96% 97.72% -0.25% ========================================== Files 28 28 Lines 738 746 +8 Branches 189 191 +2 ========================================== + Hits 723 729 +6 - Misses 11 13 +2 Partials 4 4 ``` | [Impacted Files](https://codecov.io/gh/urbica/react-map-gl/pull/527?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urbica) | Coverage Δ | | |---|---|---| | [src/components/Image/index.js](https://codecov.io/gh/urbica/react-map-gl/pull/527?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urbica#diff-c3JjL2NvbXBvbmVudHMvSW1hZ2UvaW5kZXguanM=) | `95.55% <85.71%> (-4.45%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urbica). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urbica)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.