Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix(dashboard): set initial size for map

Carl-Gerhard Lindesvärd38ff55f2039b
diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/realtime/map/map.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/realtime/map/map.tsx
index a66bf3e16..793031da9 100644
--- a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/realtime/map/map.tsx
+++ b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/realtime/map/map.tsx
@@ -70,6 +70,15 @@ const Map = ({ markers }: Props) => {
});
}, []);
+ useEffect(() => {
+ if (ref.current) {
+ setSize({
+ width: ref.current.clientWidth,
+ height: ref.current.clientHeight,
+ });
+ }
+ }, []);
+
const adjustSizeBasedOnZoom = (size: number) => {
const minMultiplier = 1;
const maxMultiplier = 7;