Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react to breaking change in 3.0 wrt ecsql query row format (backport #3257) #3259

Merged
merged 2 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/appui-react",
"comment": "React to 3.0 breaking change w.r.t ECSQL Query Row Format",
"type": "none"
}
],
"packageName": "@itwin/appui-react"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-frontend",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-frontend"
}
2 changes: 1 addition & 1 deletion core/frontend/src/CategorySelectorState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class CategorySelectorState extends ElementState {
public get name(): string { return this.code.value; }

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

/** Determine whether this CategorySelector includes the specified category */
public isCategoryViewed(categoryId: Id64String): boolean { return this.has(categoryId); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

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

// istanbul ignore else
if (iModel) {
const rowIterator = iModel.query(ecsql2);
const rowIterator = iModel.query(ecsql2, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames });
// istanbul ignore next
for await (const row of rowIterator) {
const subCategoryIds = iModel.subcategories.getSubCategories(row.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe("CategoryTree", () => {
return;
}

imodelMock.setup((x) => x.query(moq.It.isAny())).returns(() => generator());
imodelMock.setup((x) => x.query(moq.It.isAny(), moq.It.isAny(), moq.It.isAny())).returns(() => generator());
viewportMock.setup((x) => x.view).returns(() => viewStateMock.object);
viewStateMock.setup((x) => x.is3d()).returns(() => true);

Expand Down Expand Up @@ -412,7 +412,7 @@ describe("CategoryTree", () => {
return;
}

imodelMock.setup((x) => x.query(moq.It.isAny())).returns(() => generator());
imodelMock.setup((x) => x.query(moq.It.isAny(), moq.It.isAny(), moq.It.isAny())).returns(() => generator());
imodelMock.setup((x) => x.subcategories).returns(() => subcategoriesCacheMock.object);
});

Expand Down