@trailstash/ultra 3.5.1 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/components/ultra-map.js
CHANGED
|
@@ -30,6 +30,7 @@ export class UltraMap extends HTMLElement {
|
|
|
30
30
|
#init;
|
|
31
31
|
#shadow;
|
|
32
32
|
|
|
33
|
+
#cachedBBox;
|
|
33
34
|
#cachedType;
|
|
34
35
|
#cachedQuery;
|
|
35
36
|
#cachedSource;
|
|
@@ -263,8 +264,12 @@ export class UltraMap extends HTMLElement {
|
|
|
263
264
|
if (
|
|
264
265
|
!this.#cachedSource ||
|
|
265
266
|
this.type !== this.#cachedType ||
|
|
266
|
-
query !== this.#cachedQuery
|
|
267
|
+
query !== this.#cachedQuery ||
|
|
268
|
+
(queryProvider.invalidateCacheOnBBox &&
|
|
269
|
+
this.#cachedBBox !=
|
|
270
|
+
setQueryBounds("{{bbox}}", this.refs.mapLibre.bounds))
|
|
267
271
|
) {
|
|
272
|
+
this.#cachedBBox = setQueryBounds("{{bbox}}", this.refs.mapLibre.bounds);
|
|
268
273
|
this.#cachedQuery = query;
|
|
269
274
|
this.#cachedType = this.type;
|
|
270
275
|
this.#cachedSource = await queryProvider.source(query, controller, {
|
|
@@ -3,6 +3,7 @@ export default class AutoProvider {
|
|
|
3
3
|
#layers;
|
|
4
4
|
#popupContextBuilder;
|
|
5
5
|
#popupTemplate;
|
|
6
|
+
#invalidateCacheOnBBox;
|
|
6
7
|
#providers;
|
|
7
8
|
|
|
8
9
|
constructor(providers = {}) {
|
|
@@ -23,6 +24,7 @@ export default class AutoProvider {
|
|
|
23
24
|
this.#layers = provider.layers;
|
|
24
25
|
this.#popupContextBuilder = provider.popupContextBuilder;
|
|
25
26
|
this.#popupTemplate = provider.popupTemplate;
|
|
27
|
+
this.#invalidateCacheOnBBox = provider.invalidateCacheOnBBox;
|
|
26
28
|
return provider.source(query, controller, { server, bounds });
|
|
27
29
|
}
|
|
28
30
|
}
|
|
@@ -44,4 +46,16 @@ export default class AutoProvider {
|
|
|
44
46
|
get popupTemplate() {
|
|
45
47
|
return this.#popupTemplate;
|
|
46
48
|
}
|
|
49
|
+
|
|
50
|
+
get popupTemplate() {
|
|
51
|
+
return this.#popupTemplate;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get invalidateCacheOnBBox() {
|
|
55
|
+
// This isn't ideal, because this is called _before_ `source`, but it will work because it's either:
|
|
56
|
+
// * undefined & the first run, so bc first run it always will execute anyway
|
|
57
|
+
// * different type, which might mean a different invalidateCacheOnBBox value, but we always run on new type anyway
|
|
58
|
+
// * type unchanged, & subsequent run, so actually valid value
|
|
59
|
+
return this.#invalidateCacheOnBBox;
|
|
60
|
+
}
|
|
47
61
|
}
|
|
@@ -126,6 +126,7 @@ export const osmWebsite = {
|
|
|
126
126
|
return !!query.match(osmUrlRe);
|
|
127
127
|
},
|
|
128
128
|
fitBounds: true,
|
|
129
|
+
invalidateCacheOnBBox: true,
|
|
129
130
|
};
|
|
130
131
|
|
|
131
132
|
export const osmWiki = {
|
|
@@ -165,4 +166,5 @@ out geom;`,
|
|
|
165
166
|
const page = decodeURIComponent(url.pathname.slice(6));
|
|
166
167
|
return page.split(":")[0] === "Tag" || page.split(":")[0] === "Key";
|
|
167
168
|
},
|
|
169
|
+
invalidateCacheOnBBox: true,
|
|
168
170
|
};
|
package/package.json
CHANGED