Skip to content

Commit a2809a9

Browse files
committed
make it clearer that the added protocol is for PMTiles only
1 parent 7693217 commit a2809a9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/components/MapMaplibreGl.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type MapMaplibreGlState = {
7575
geocoder: MaplibreGeocoder | null;
7676
zoomControl: ZoomControl | null;
7777
zoom?: number;
78-
protocol: Protocol | null;
78+
pmtilesProtocol: Protocol | null;
7979
};
8080

8181
class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps, MapMaplibreGlState> {
@@ -95,7 +95,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
9595
inspect: null,
9696
geocoder: null,
9797
zoomControl: null,
98-
protocol: new Protocol({metadata: true})
98+
pmtilesProtocol: new Protocol({metadata: true})
9999
}
100100
i18next.on('languageChanged', () => {
101101
this.forceUpdate();
@@ -140,7 +140,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
140140

141141
if (this.props.localPMTiles) {
142142
const file = this.props.localPMTiles;
143-
this.state.protocol!.add(file); // this is necessary for non-HTTP sources
143+
this.state.pmtilesProtocol!.add(file); // this is necessary for non-HTTP sources
144144

145145
if (map) {
146146
file.getMetadata().then((metadata: any) => {
@@ -166,8 +166,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
166166
localIdeographFontFamily: false
167167
} satisfies MapOptions;
168168

169-
const protocol = this.state.protocol;
170-
MapLibreGl.addProtocol("pmtiles", protocol!.tile);
169+
MapLibreGl.addProtocol("pmtiles", this.state.pmtilesProtocol!.tile);
171170

172171
const map = new MapLibreGl.Map(mapOpts);
173172

0 commit comments

Comments
 (0)