Skip to content

Commit d1db893

Browse files
authored
react to breaking change in 3.0 wrt ecsql query row format (#3257)
Co-authored-by: Arun George <[email protected]>
1 parent 69af63a commit d1db893

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/appui-react",
5+
"comment": "React to 3.0 breaking change w.r.t ECSQL Query Row Format",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/appui-react"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/core-frontend",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/core-frontend"
10+
}

core/frontend/src/CategorySelectorState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class CategorySelectorState extends ElementState {
7171
public get name(): string { return this.code.value; }
7272

7373
/** Determine whether this CategorySelector includes the specified categoryId string */
74-
public has(id: Id64String): boolean { return this.categories.has(id.toString()); }
74+
public has(id: Id64String): boolean { return this.categories.has(id); }
7575

7676
/** Determine whether this CategorySelector includes the specified category */
7777
public isCategoryViewed(categoryId: Id64String): boolean { return this.has(categoryId); }

ui/appui-react/src/appui-react/imodel-components/category-tree/CategoryVisibilityHandler.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import * as React from "react";
1010
import { BeEvent } from "@itwin/core-bentley";
11+
import { QueryRowFormat } from "@itwin/core-common";
1112
import { IModelConnection, PerModelCategoryVisibility, ViewManager, Viewport } from "@itwin/core-frontend";
1213
import { NodeKey } from "@itwin/presentation-common";
1314
import { TreeNodeItem, useAsyncValue } from "@itwin/components-react";
@@ -40,7 +41,7 @@ export async function loadCategoriesFromViewport(iModel?: IModelConnection, vp?:
4041

4142
// istanbul ignore else
4243
if (iModel) {
43-
const rowIterator = iModel.query(ecsql2);
44+
const rowIterator = iModel.query(ecsql2, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames });
4445
// istanbul ignore next
4546
for await (const row of rowIterator) {
4647
const subCategoryIds = iModel.subcategories.getSubCategories(row.id);

ui/appui-react/src/test/imodel-components/category-tree/CategoriesTree.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe("CategoryTree", () => {
6767
return;
6868
}
6969

70-
imodelMock.setup((x) => x.query(moq.It.isAny())).returns(() => generator());
70+
imodelMock.setup((x) => x.query(moq.It.isAny(), moq.It.isAny(), moq.It.isAny())).returns(() => generator());
7171
viewportMock.setup((x) => x.view).returns(() => viewStateMock.object);
7272
viewStateMock.setup((x) => x.is3d()).returns(() => true);
7373

@@ -412,7 +412,7 @@ describe("CategoryTree", () => {
412412
return;
413413
}
414414

415-
imodelMock.setup((x) => x.query(moq.It.isAny())).returns(() => generator());
415+
imodelMock.setup((x) => x.query(moq.It.isAny(), moq.It.isAny(), moq.It.isAny())).returns(() => generator());
416416
imodelMock.setup((x) => x.subcategories).returns(() => subcategoriesCacheMock.object);
417417
});
418418

0 commit comments

Comments
 (0)