Skip to content

Commit 9412e9e

Browse files
Updates for observables in Web 5.37.0 (#140)
* updates * fix errors * revert lock * try again --------- Co-authored-by: Scott Anderson <sanderson@latitudegeo.com>
1 parent 5fb3879 commit 9412e9e

23 files changed

Lines changed: 1153 additions & 261 deletions

File tree

samples/arcade-editor/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"start": "vertigis-web-sdk start"
88
},
99
"dependencies": {
10-
"@arcgis/coding-components-react": "4.30.7",
11-
"@esri/calcite-components-react": "2.12.0"
10+
"@arcgis/coding-components-react": "4.33.14",
11+
"@esri/calcite-components-react": "3.2.1"
1212
},
1313
"devDependencies": {
14-
"@vertigis/web": "~5.33.0",
14+
"@vertigis/web": "^5.37.0",
1515
"@vertigis/web-sdk": "~1.11.0",
1616
"typescript": "~5.3.3"
1717
}

samples/arcade-editor/src/components/ArcadeEditor/ArcadeEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ArcgisArcadeEditor } from "@arcgis/coding-components-react";
1+
import { ArcgisArcadeEditor } from "@arcgis/coding-components-react/dist/components";
22
import type { LayoutElementProperties } from "@vertigis/web/components";
33
import { LayoutElement } from "@vertigis/web/components";
44
import { useWatchAndRerender } from "@vertigis/web/ui";

samples/arcade-editor/src/components/ArcadeEditor/ArcadeEditorModel.ts

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,21 @@ interface ArcadeEditorModelProperties extends ComponentModelProperties {
2828
@serializable
2929
export default class ArcadeEditorModel extends ComponentModelBase<ArcadeEditorModelProperties> {
3030
@importModel("map-extension")
31-
map: MapModel;
31+
get map(): MapModel {
32+
return this._map;
33+
}
34+
set map(value: MapModel) {
35+
this._map = value;
36+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
37+
this._onMapChanged();
38+
}
3239

3340
data: ArcadeEditorData;
3441
layerName: string;
3542
featureLayer: __esri.FeatureLayer;
3643

44+
private _map: MapModel;
45+
3746
constructor(props: ArcadeEditorModelProperties) {
3847
super(props);
3948
this.layerName = props.layerName;
@@ -58,22 +67,22 @@ export default class ArcadeEditorModel extends ComponentModelBase<ArcadeEditorMo
5867
};
5968
}
6069

61-
protected override async _onInitialize(): Promise<void> {
62-
const watchHandle = this.watch("map", async () => {
63-
if (!this.map) {
64-
return undefined;
65-
}
66-
const extension = toLayerExtension(this.layerName, this.map);
67-
if (
68-
isLayerExtension(extension) &&
69-
(extension as FeatureLayerExtension).layer.type === "feature"
70-
) {
71-
this.featureLayer = (extension as FeatureLayerExtension).layer;
72-
}
73-
watchHandle.remove();
74-
await this.messages
75-
.command<HasFeatures>("arcade-editor.load-data")
76-
.execute({ features: [] });
77-
});
70+
protected async _onMapChanged(): Promise<void> {
71+
if (!this.map) {
72+
return undefined;
73+
}
74+
75+
const extension = toLayerExtension(this.layerName, this.map);
76+
77+
if (
78+
isLayerExtension(extension) &&
79+
(extension as FeatureLayerExtension).layer.type === "feature"
80+
) {
81+
this.featureLayer = (extension as FeatureLayerExtension).layer;
82+
}
83+
84+
await this.messages
85+
.command<HasFeatures>("arcade-editor.load-data")
86+
.execute({ features: [] });
7887
}
7988
}

samples/arcade-editor/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { setAssetPath as setCalciteComponentsAssetPath } from "@esri/calcite-components/dist/components";
1+
import { setAssetPath as setCalciteComponentsAssetPath } from "@esri/calcite-components";
22
import type { LibraryRegistry } from "@vertigis/web/config";
33

44
import ArcadeEditor from "./components/ArcadeEditor";
55
import ArcadeEditorModel from "./components/ArcadeEditor/ArcadeEditorModel";
66

77
// Individual imports for each component used in this sample
8-
import "@arcgis/coding-components/dist/components/arcgis-arcade-editor";
9-
import "@esri/calcite-components/dist/components/calcite-scrim";
8+
import "@arcgis/coding-components/components/arcgis-arcade-editor";
9+
import "@esri/calcite-components/components/calcite-scrim";
1010

1111
// Set the asset path for calcite components
1212
setCalciteComponentsAssetPath(

samples/arcgis-widget/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"start-in-sandbox": "SOCK_PORT=443 vertigis-web-sdk start"
99
},
1010
"devDependencies": {
11-
"@vertigis/web": "~5.33.0",
11+
"@vertigis/web": "^5.37.0",
1212
"@vertigis/web-sdk": "~1.11.0",
1313
"typescript": "~5.3.3"
1414
}

samples/arcgis-widget/src/components/Daylight/Daylight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Daylight = (props: DaylightWidgetProps): ReactElement => {
3434
useWatchAndRerender(props.model, "dateOrSeason");
3535
useWatch(props.model, "dateOrSeason", (newValue) => {
3636
if (widget) {
37-
widget.dateOrSeason = newValue as "date" | "season";
37+
widget.dateOrSeason = newValue;
3838
}
3939
});
4040

samples/basic-component/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"start-in-sandbox": "SOCK_PORT=443 vertigis-web-sdk start"
99
},
1010
"devDependencies": {
11-
"@vertigis/web": "~5.33.0",
11+
"@vertigis/web": "^5.37.0",
1212
"@vertigis/web-sdk": "~1.11.0",
1313
"typescript": "~5.3.3"
1414
}

samples/basic-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"start-in-sandbox": "SOCK_PORT=443 vertigis-web-sdk start"
99
},
1010
"devDependencies": {
11-
"@vertigis/web": "~5.33.0",
11+
"@vertigis/web": "^5.37.0",
1212
"@vertigis/web-sdk": "~1.11.0",
1313
"typescript": "~5.3.3"
1414
}

samples/commands-and-operations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"start-in-sandbox": "SOCK_PORT=443 vertigis-web-sdk start"
99
},
1010
"devDependencies": {
11-
"@vertigis/web": "~5.33.0",
11+
"@vertigis/web": "^5.37.0",
1212
"@vertigis/web-sdk": "~1.11.0",
1313
"typescript": "~5.3.3"
1414
}

samples/embedded-map/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"mapillary-js": "^4.0.0"
1313
},
1414
"devDependencies": {
15-
"@vertigis/web": "~5.33.0",
15+
"@vertigis/web": "^5.37.0",
1616
"@vertigis/web-sdk": "~1.11.0",
1717
"typescript": "~5.3.3"
1818
}

0 commit comments

Comments
 (0)