Skip to content

Commit

Permalink
fix(advanced-marker): remove content element in cleanup (#351)
Browse files Browse the repository at this point in the history
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
  • Loading branch information
Juneezee authored May 9, 2024
1 parent bc10a6f commit 128df87
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/advanced-marker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,17 @@ function useAdvancedMarker(props: AdvancedMarkerProps) {
setMarker(newMarker);

// create the container for marker content if there are children
let contentElement: HTMLDivElement | null = null;
if (numChildren > 0) {
const contentElement = document.createElement('div');
contentElement = document.createElement('div');

newMarker.content = contentElement;
setContentContainer(contentElement);
}

return () => {
newMarker.map = null;
contentElement?.remove();
setMarker(null);
setContentContainer(null);
};
Expand Down

0 comments on commit 128df87

Please sign in to comment.