Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI update: - explicitly update route when switching realm (also _tree is a mandatory prop so it always exists) - simplyfy the onassetselectionchanged event

Vincent081c0e318bbc
diff --git a/ui/app/manager/src/pages/page-assets.ts b/ui/app/manager/src/pages/page-assets.ts
index a0577121c..31b67dbc9 100644
--- a/ui/app/manager/src/pages/page-assets.ts
+++ b/ui/app/manager/src/pages/page-assets.ts
@@ -141,10 +141,11 @@ class PageAssets<S extends AppStateKeyed> extends Page<S> {
protected getRealmState = createSelector(
[this._realmSelector],
- async (realm) => {
- if (this._tree) {
- this._tree.refresh();
- }
+ async () => {
+ this._assetIds = undefined;
+ this._viewer.assetId = undefined;
+ this._tree.refresh();
+ this._updateRoute(true);
}
)
@@ -199,8 +200,7 @@ class PageAssets<S extends AppStateKeyed> extends Page<S> {
protected _onAssetSelectionChanged(event: OrAssetTreeSelectionEvent) {
const nodes = event.detail.newNodes;
- const newIds = event.detail.newNodes.map((node) => node.asset.id!);
- this._assetIds = newIds;
+ this._assetIds = event.detail.newNodes.map((node) => node.asset.id!);
this._viewer.assetId = nodes.length === 1 ? nodes[0].asset!.id : undefined;
this._updateRoute(true);
}