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

fix(react-components): various small fixes and bump react-components to 0.55.4 #4702

Merged
merged 2 commits into from
Aug 13, 2024
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
2 changes: 1 addition & 1 deletion react-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cognite/reveal-react-components",
"version": "0.55.3",
"version": "0.55.4",
"exports": {
".": {
"import": "./dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,18 @@ export class RevisionFdmNodeCache {
mappingConnections: FdmCadConnection[],
nodes: Node3D[]
): Array<{ connection: FdmCadConnection; treeIndex: TreeIndex }> {
return mappingConnections.map((connection) => {
return mappingConnections.reduce((acc, connection) => {
const nodeInConnection = nodes.find((node) => node.id === connection.nodeId);

assert(nodeInConnection !== undefined);
if (nodeInConnection !== undefined) {
acc.push({
connection,
treeIndex: nodeInConnection.treeIndex
});
}

return {
connection,
treeIndex: nodeInConnection.treeIndex
};
});
return acc;
}, new Array<{ connection: FdmCadConnection; treeIndex: TreeIndex }>());
danpriori marked this conversation as resolved.
Show resolved Hide resolved
}

private async getMappingConnectionsForAncestors(
Expand Down
2 changes: 1 addition & 1 deletion react-components/src/data-providers/FdmSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ function hoistInstanceProperties(
});
}

function makeSureNonEmptyFilterForRequest(
export function makeSureNonEmptyFilterForRequest(
filter: InstanceFilter | undefined
): InstanceFilter | undefined {
return filter !== undefined && Object.keys(filter).length === 0 ? undefined : filter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
* Copyright 2024 Cognite AS
*/
import { type AddModelOptions } from '@cognite/reveal';
import { type InstanceFilter, type Query, type Source } from '../FdmSDK';
import {
makeSureNonEmptyFilterForRequest,
type InstanceFilter,
type Query,
type Source
} from '../FdmSDK';
import { SYSTEM_3D_EDGE_SOURCE } from './dataModels';

export function createMappedEquipmentQuery(
Expand All @@ -12,6 +17,8 @@ export function createMappedEquipmentQuery(
limit: number = 10000,
cursors?: Record<string, string>
): Query {
instanceFilter = makeSureNonEmptyFilterForRequest(instanceFilter);

return {
with: {
mapped_edges: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const useMappingsForAssetIds = (
nextCursor.model.revisionId === model.revisionId
)?.cursor;

if (nextCursor === undefined) {
if (nextCursor === undefined || assetIds.length === 0) {
danpriori marked this conversation as resolved.
Show resolved Hide resolved
return { mappings: { items: [] }, model };
}

Expand Down
Loading