Skip to content

Commit 343718d

Browse files
committed
Defer geospatial map components
1 parent bcc437d commit 343718d

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<div class="container">
22
<h1>{{ 'browse.metadata.map' | translate }}</h1>
33
@if (isPlatformBrowser(platformId)) {
4-
<ds-geospatial-map [facetValues]="facetValues$"
5-
[currentScope]="this.scope$|async"
6-
[layout]="'browse'"
7-
style="width: 100%;">
8-
</ds-geospatial-map>
4+
@defer {
5+
<ds-geospatial-map [facetValues]="facetValues$"
6+
[currentScope]="this.scope$|async"
7+
[layout]="'browse'"
8+
style="width: 100%;">
9+
</ds-geospatial-map>
10+
}
911
}
1012
</div>
1113

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
@if (isNotEmpty(points) || isNotEmpty(bboxes)) {
22
<div>
33
<ds-metadata-field-wrapper [label]="label | translate">
4+
@defer {
45
<ds-geospatial-map [coordinates]="this.points"
56
[bbox]="this.bboxes"
67
[cluster]="this.cluster"
78
[layout]="'item'"
89
style="width: 100%;">
910
</ds-geospatial-map>
11+
}
1012
</ds-metadata-field-wrapper>
1113
</div>
1214
}

src/app/shared/geospatial-map/geospatial-map.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ export class GeospatialMapComponent implements AfterViewInit, OnInit, OnDestroy
134134
private initMap(): void {
135135
// 'Import' leaflet packages in a browser-mode-only way to avoid issues with SSR
136136
const L = require('leaflet'); require('leaflet.markercluster'); require('leaflet-providers');
137+
138+
console.log(`GeospatialMapComponent.initMap()`, L); // todo: remove this
139+
137140
// Set better default icons
138141
L.Icon.Default.mergeOptions({
139142
iconRetinaUrl: 'assets/images/marker-icon-2x.png',

src/app/shared/object-collection/object-collection.component.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
@if ((currentMode$ | async) === viewModeEnum.GeospatialMap) {
2-
<ds-object-geospatial-map [objects]="objects">
3-
</ds-object-geospatial-map>
2+
@defer {
3+
<ds-object-geospatial-map [objects]="objects">
4+
</ds-object-geospatial-map>
5+
}
46
}
57

68
@if ((currentMode$ | async) === viewModeEnum.ListElement || (currentMode$ | async) === viewModeEnum.GeospatialMap) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@if (isPlatformBrowser(platformId)) {
2-
<ds-geospatial-map [mapInfo]="mapInfo"></ds-geospatial-map>
2+
<ds-geospatial-map [mapInfo]="mapInfo"></ds-geospatial-map>
33
}

0 commit comments

Comments
 (0)