Skip to content

Commit

Permalink
Merge pull request #1033 from visualize-admin/fix/copying-map-chart
Browse files Browse the repository at this point in the history
fix: Undefined Map handlers during unmount
  • Loading branch information
bprusinowski authored May 15, 2023
2 parents 6a2d4f2 + d490d27 commit d036dc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/charts/map/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ export const MapComponent = () => {
onIdle={() => {
setLoaded(true);
}}
onRemove={() => {
setLoaded(false);
setMap(null);
}}
onLoad={(e) => {
setMap(e.target);
currentBBox.current = e.target.getBounds().toArray() as BBox;
Expand Down
2 changes: 1 addition & 1 deletion app/charts/map/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const getMap = () => {
return map;
};

const setMap = (d: Map) => {
const setMap = (d: Map | null) => {
map = d;
};

Expand Down

1 comment on commit d036dc6

@vercel
Copy link

@vercel vercel bot commented on d036dc6 May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-alpha.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-ixt1.vercel.app

Please sign in to comment.