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

Setting file with unexped ended json #160

Open
linonetwo opened this issue Oct 27, 2021 · 4 comments
Open

Setting file with unexped ended json #160

linonetwo opened this issue Oct 27, 2021 · 4 comments

Comments

@linonetwo
Copy link

linonetwo commented Oct 27, 2021

{"workspaces":{"bd2761d6-507f-4099-9289-8c15fdca3673":{"storageService":"local","userName":"","gitUrl":null,"isSubWiki":false,"mainWikiToLink":null,"mainWikiID":null,"name":"wiki","tagName":null,"port":5212,"wikiFolderLocation":"E:\twtest\001\wiki","active":true,"disableAudio":false,"disableNotifications":false,"hibernated":false,"hibernateWhenUnused":false,"homeUrl":"http://0.0.0.0:5212","id":"bd2761d6-507f-4099-9289-8c15fdca3673","lastUrl":"http://192.168.80.129:5212/#GettingStarted:GettingStarted","order":1,"picturePath":null,"subWikiFolderName":"subwiki","syncOnInterval":false,"syncOnIntervalDebounced":false,"syncOnStartup":true,"transparentBackground":false},"4339c1e8-1b86-43f4-a7f4-515eb584b46a":{"storageService":"local","userName":"","gitUrl":null,"isSubWiki":false,"mainWikiToLink":null,"mainWikiID":null,"name":"002","tagName":null,"port":5213,"wikiFolderLocation":"E:\\twtest\\002","active":false,"disableAudio":false,"disableNotifications":false,"hibernated":false,"hibernateWhenUnused":false,"homeUrl":"http://0.0.0.0:5213","id":"4339c1e8-1b86-43f4-a7f4-515eb584b46a","lastUrl":"http://192.168.80.129:5213/#","order":2,"picturePath":null,"subWikiFolderName":"subwiki","syncOnInterval":false,"syncOnIntervalDebounced":false,"syncOnStartup":true,"transparentBackground":false}}}ransparentBackground":false}}}

Look at the }}}ransparentBackground":false}}} in the end, probably this is the result of disabling atomicSave in #159?

@linonetwo
Copy link
Author

linonetwo commented Oct 27, 2021

This is caused by quickly call await settings.set(workspaces.${id}, { ...workspace }); in

  public async set(id: string, workspace: IWorkspace): Promise<void> {
    this.workspaces[id] = this.sanitizeWorkspace(workspace);
    await this.reactBeforeWorkspaceChanged(workspace);
    await settings.set(`workspaces.${id}`, { ...workspace });
    await this.updateWorkspaceSubject();
    await this.updateWorkspaceMenuItems();
  }

@PeterBenko
Copy link

Looks like the default name for the settings file has changed between versions 3.2.0 and 4.0.0: before vs after

@linonetwo
Copy link
Author

I fixed broken json using best-effort-json-parser package.

@PeterBenko
Copy link

Ah, fair. I guess I misunderstood your initial ticket :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants