Skip to content

Commit b7290b2

Browse files
committed
chore: reset cache
1 parent b9be8e3 commit b7290b2

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

src/components/map/leaflet-utils.ts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class Leaflet {
148148
'lat' in options.initialValue &&
149149
'lng' in options.initialValue
150150
) {
151-
L.marker(options.initialValue as any, {
151+
const marker = L.marker(options.initialValue as any, {
152152
icon: L.icon({
153153
iconUrl:
154154
'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png',
@@ -160,6 +160,12 @@ export class Leaflet {
160160

161161
this.map.setView(options.initialValue, 5)
162162

163+
// Dispatch draw event for initial point so components can react
164+
this.dispatch('draw', {
165+
geoJson: marker.toGeoJSON(),
166+
latLng: options.initialValue,
167+
})
168+
163169
return
164170
}
165171

@@ -168,7 +174,7 @@ export class Leaflet {
168174
((options.initialValue as LatLngBoundsLiteral)?.length > 0 ||
169175
'getNorthEast' in options.initialValue)
170176
) {
171-
L.rectangle(options.initialValue as LatLngBoundsExpression, {
177+
const rectangle = L.rectangle(options.initialValue as LatLngBoundsExpression, {
172178
stroke: true,
173179
color: '#3388ff',
174180
weight: 4,
@@ -178,6 +184,12 @@ export class Leaflet {
178184
}).addTo(this.editableLayers)
179185

180186
this.map.fitBounds(options.initialValue)
187+
188+
// Dispatch draw event for initial bounds so components can react
189+
this.dispatch('draw', {
190+
geoJson: rectangle.toGeoJSON(),
191+
bounds: rectangle.getBounds(),
192+
})
181193
}
182194
})
183195
}
@@ -237,14 +249,14 @@ export class Leaflet {
237249
marker: options?.hidePointSelectionDrawTool
238250
? false
239251
: {
240-
icon: L.icon({
241-
iconUrl:
242-
'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png',
243-
iconAnchor: [15, 40],
244-
shadowUrl:
245-
'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
246-
}),
247-
},
252+
icon: L.icon({
253+
iconUrl:
254+
'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png',
255+
iconAnchor: [15, 40],
256+
shadowUrl:
257+
'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
258+
}),
259+
},
248260
},
249261
edit: {
250262
featureGroup: this.editableLayers, //REQUIRED!!

src/internal/indexeddb.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ export async function getDb() {
3333
keyPath: 'key',
3434
})
3535
}
36+
37+
if (oldVersion < 4) {
38+
// an older version of the code had a bug where time average maps were being cached without the variable entry ID in the key
39+
db.deleteObjectStore(IndexedDbStores.TIME_SERIES)
40+
db.createObjectStore(IndexedDbStores.TIME_SERIES, {
41+
keyPath: 'key',
42+
})
43+
}
3644
},
3745
})
3846
}

0 commit comments

Comments
 (0)