Skip to content

Commit

Permalink
Removed default value and small optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Savokr committed Sep 11, 2023
1 parent e65aab0 commit a1a60f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class FdmNodeCache {

const fdmKeySet = new Set(uniqueIds.map((id) => createFdmKey(id.space, id.externalId)));

const revisionToEdgesMap = await this.getAndCacheRevisionToEdgesMap(modelRevisions);
const revisionToEdgesMap = await this.getAndCacheRevisionToEdgesMap(modelRevisions, false);

const modelDataPromises = modelRevisions.map(async ({ modelId, revisionId }) => {
const revisionKey = createModelRevisionKey(modelId, revisionId);
Expand Down Expand Up @@ -226,7 +226,7 @@ export class FdmNodeCache {

private async getAndCacheRevisionToEdgesMap(
modelRevisionIds: ModelRevisionId[],
fetchViews: boolean = false
fetchViews: boolean
): Promise<Map<ModelRevisionKey, FdmEdgeWithNode[]>> {
const revisionIds = modelRevisionIds.map((modelRevisionId) => modelRevisionId.revisionId);
const edges = await this.getEdgesForRevisions(revisionIds, this._fdmClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,12 @@ export class RevisionFdmNodeCache {

public insertTreeIndexMappings(treeIndex: TreeIndex, edge: FdmEdgeWithNode): void {
const edgeArray = this._treeIndexToFdmEdges.get(treeIndex);
const presentEdge = edgeArray?.find((e) => e.node.id === edge.node.id);

if (edgeArray === undefined) {
this._treeIndexToFdmEdges.set(treeIndex, [edge]);
} else {
const presentEdge = edgeArray?.find((e) => e.node.id === edge.node.id);

if (presentEdge !== undefined) {
presentEdge.view = edge.view;
return;
Expand Down

0 comments on commit a1a60f7

Please sign in to comment.