Skip to content

Commit cacdac4

Browse files
committed
fix: critical map/webgl bug
1 parent 42833d3 commit cacdac4

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

components/domain/hosting/hosting-map.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"use client";
22

3-
import { memo } from "react";
43
import MapboxMap, { Marker, NavigationControl } from "react-map-gl/mapbox";
54
import type { Hosting } from "@/lib/schemas";
65

7-
function MapInner({ hosting }: { hosting: Hosting }) {
6+
export function HostingMap({ hosting }: { hosting: Hosting }) {
87
if (!process.env.NEXT_PUBLIC_MAPBOX_TOKEN) return null;
98

109
const lat = hosting.geo.lat;
@@ -26,7 +25,6 @@ function MapInner({ hosting }: { hosting: Hosting }) {
2625
touchZoomRotate={false}
2726
style={{ height: 280, width: "100%" }}
2827
mapStyle="mapbox://styles/mapbox/standard"
29-
reuseMaps
3028
>
3129
<Marker longitude={lon} latitude={lat}>
3230
<div className="h-4 w-4 rounded-full bg-blue-600 shadow-2xl ring-2 ring-white" />
@@ -36,9 +34,3 @@ function MapInner({ hosting }: { hosting: Hosting }) {
3634
</div>
3735
);
3836
}
39-
40-
export const HostingMap = memo(MapInner, (prev, next) => {
41-
const p = prev.hosting.geo;
42-
const n = next.hosting.geo;
43-
return p.lat === n.lat && p.lon === n.lon;
44-
});

components/domain/hosting/hosting-section.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import { hasFlag } from "country-flag-icons";
44
import { MailQuestionMark } from "lucide-react";
5-
import dynamic from "next/dynamic";
6-
import { MapSkeleton } from "@/components/domain/hosting/map-skeleton";
5+
import { HostingMap } from "@/components/domain/hosting/hosting-map";
76
import { KeyValue } from "@/components/domain/key-value";
87
import { KeyValueGrid } from "@/components/domain/key-value-grid";
98
import { Section } from "@/components/domain/section";
@@ -19,15 +18,6 @@ import type { Hosting } from "@/lib/schemas";
1918
import { sections } from "@/lib/sections-meta";
2019
import { cn } from "@/lib/utils";
2120

22-
const HostingMap = dynamic(
23-
() =>
24-
import("@/components/domain/hosting/hosting-map").then((m) => m.HostingMap),
25-
{
26-
ssr: false,
27-
loading: () => <MapSkeleton />,
28-
},
29-
);
30-
3121
function formatLocation(geo: Hosting["geo"]): string {
3222
const parts = [geo.city, geo.region, geo.country].filter(Boolean);
3323
return parts.join(", ");

0 commit comments

Comments
 (0)