Skip to content

Commit

Permalink
Fixed problems with instancesByJsName, IdeSettings state is now saved…
Browse files Browse the repository at this point in the history
… properly
  • Loading branch information
Lorthiz committed Jun 27, 2024
1 parent 8886488 commit 961d4b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/v1/utils/Compilation/JsImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export class JsImporter implements IYamlImporter {

const ksyModel = YamlParser.parseIKsyFile(<string>ksyContent, fn);
Object.assign(this.ksyTypes, SchemaUtils.collectKsyTypes(ksyModel));
return ksyModel;

// we have to modify the schema (add typesByJsName for example) before sending into the compiler, so we need a copy
const compilerSchema = YamlParser.parseIKsyFile(<string>ksyContent, fn);
return compilerSchema;
}
}
9 changes: 3 additions & 6 deletions src/v1/utils/Compilation/SchemaUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ export class SchemaUtils {
}

static collectKsyTypes(schema: KsySchema.IKsyFile): IKsyTypes {
// Function was modifying input and the reason was:
// we have to modify the schema (add typesByJsName for example) before sending into the compiler, so we need a copy
const schemaTemp = {...schema};
var types: IKsyTypes = {};
SchemaUtils.collectTypes(types, schemaTemp);
SchemaUtils.collectTypes(types, schema);

var typeName = SchemaUtils.ksyNameToJsName(schemaTemp.meta.id, false);
types[typeName] = schemaTemp;
var typeName = SchemaUtils.ksyNameToJsName(schema.meta.id, false);
types[typeName] = schema;

return types;
}
Expand Down
5 changes: 4 additions & 1 deletion src/v1/utils/LocalStorageApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export class LocalStorageApi {
}

public static storeIdeSettings = (store: IdeSettings): void => {
localStorage.setItem("ideSettings", JSON.stringify(store));
const state: IdeSettings = {
eagerMode: store.eagerMode
};
localStorage.setItem("ideSettings", JSON.stringify(state));
}

public static getDoNotShowWelcomeFlag = (): boolean => {
Expand Down

0 comments on commit 961d4b7

Please sign in to comment.