Skip to content

Commit 6c3bbf6

Browse files
committed
Remove unneeded platform checks
1 parent c147354 commit 6c3bbf6

File tree

5 files changed

+16
-15
lines changed

5 files changed

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

src/app/browse-by/browse-by-geospatial-data/browse-by-geospatial-data.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import {
66
import {
77
ChangeDetectionStrategy,
88
Component,
9-
Inject,
109
OnInit,
11-
PLATFORM_ID,
1210
} from '@angular/core';
1311
import {
1412
ActivatedRoute,
@@ -67,7 +65,6 @@ export class BrowseByGeospatialDataComponent implements OnInit {
6765
public facetValues$: Observable<FacetValues> = of(null);
6866

6967
constructor(
70-
@Inject(PLATFORM_ID) public platformId: string,
7168
private searchConfigurationService: SearchConfigurationService,
7269
private searchService: SearchService,
7370
protected route: ActivatedRoute,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import { GeospatialMapDetail } from './models/geospatial-map-detail.model';
3737
* Component to draw points and polygons on a tiled map using leaflet.js
3838
* This component can be used by item page fields, the browse-by geospatial component, and the geospatial search
3939
* view mode to render related places of an item (e.g. metadata on a page), or items *as* places (e.g. browse / search)
40+
*
41+
* This component should be used in a `@defer` block to keep geospatial mapping libraries out of the main bundle!
4042
*/
4143
export class GeospatialMapComponent implements AfterViewInit, OnInit, OnDestroy {
4244

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
@if (isPlatformBrowser(platformId)) {
2-
<ds-geospatial-map [mapInfo]="mapInfo"></ds-geospatial-map>
3-
}
1+
<!--
2+
Note: ds-object-geospatial-map itself should be rendered in a @defer block, so we don't need one here.
3+
https://angular.dev/guide/templates/defer#avoid-cascading-loads-with-nested-defer-blocks
4+
-->
5+
<ds-geospatial-map [mapInfo]="mapInfo"></ds-geospatial-map>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ import { parseGeoJsonFromMetadataValue } from '../utils/geospatial.functions';
4141

4242
/**
4343
* This component is used with the GeospatialMap ViewMode in search or browse results, and
44-
* prepares geospatial data collection for display on the GeospatialMapComponent
44+
* prepares geospatial data collection for display on the GeospatialMapComponent.
45+
*
46+
* This component should be used in a `@defer` block to keep geospatial mapping libraries out of the main bundle!
4547
*/
4648
export class ObjectGeospatialMapComponent {
4749

0 commit comments

Comments
 (0)