Skip to content

Commit

Permalink
Reinforce insert function
Browse files Browse the repository at this point in the history
ONE-vscode-DCO-1.0-Signed-off-by: Dayoung Lee <[email protected]>
  • Loading branch information
dayo09 committed Oct 5, 2023
1 parent 38cde69 commit d86e060
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/OneExplorer/OneStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class CfgToCfgObjMap {
return this._map.get(path);
}

public set(path: string, cfgObj: ConfigObj) {
this.map.set(path, cfgObj);
}

// TODO Revisit here
public reset(type: NodeType, path: string) {
switch (type) {
case NodeType.config:
Expand Down Expand Up @@ -230,10 +235,16 @@ export class OneStorage {
}

public static insert(node: Node) {
// NOTE
// Only _nodeMap is built by calling this function
// _baseModelToCfgsMap and _cfgToCfgObjMap are built at constructors
OneStorage.get()._nodeMap.set(node.path, node);
const inst = OneStorage.get();
inst._nodeMap.set(node.path, node);
if (node.type === NodeType.config) {
if (!inst._cfgToCfgObjMap.get(node.path)) {
const cfgObj = ConfigObj.createConfigObj(node.uri);
if (cfgObj) {
inst._cfgToCfgObjMap.set(node.path, cfgObj);
}
}
}
}

/**
Expand Down

0 comments on commit d86e060

Please sign in to comment.