From 68c32ed1b04658acff2da0425651505b51916f3f Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Tue, 16 Jan 2024 02:30:35 +0000 Subject: [PATCH] fix ui slot mutation bug --- CHANGELOG_CN.md | 5 +++++ CHANGELOG_EN.md | 5 +++++ app/renderer/services/uislot-service.ts | 8 +++++--- package.json | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG_CN.md b/CHANGELOG_CN.md index 36c95858..1f2f94cd 100644 --- a/CHANGELOG_CN.md +++ b/CHANGELOG_CN.md @@ -1,3 +1,8 @@ +## v3.0.0-beta.3 15/01 2024 + +1. 修复了一些 Bug。 +2. 插件推荐:paperlib-ai-summary-extension + ## v3.0.0-beta.2 15/01 2024 1. 摒弃了 Windows 7 的支持。 diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md index a2de3419..73209bf0 100644 --- a/CHANGELOG_EN.md +++ b/CHANGELOG_EN.md @@ -1,3 +1,8 @@ +## v3.0.0-beta.3 Jan 15 2024 + +1. Fixed some bugs. +2. Extension Recommendation: paperlib-ai-summary-extension + ## v3.0.0-beta.2 Jan 15 2024 1. Doesn't support Windows 7 anymore. diff --git a/app/renderer/services/uislot-service.ts b/app/renderer/services/uislot-service.ts index 774b4d12..7d4dd38c 100644 --- a/app/renderer/services/uislot-service.ts +++ b/app/renderer/services/uislot-service.ts @@ -32,7 +32,7 @@ export class UISlotService extends Eventable { * @returns */ updateSlot(slotID: keyof IUISlotState, patch: { [id: string]: any }) { - const currentSlot = this.getState(slotID); + const currentSlot = JSON.parse(JSON.stringify(this.getState(slotID))); if (!currentSlot) { this._logService.error( @@ -47,9 +47,11 @@ export class UISlotService extends Eventable { for (const [sectionID, value] of Object.entries(patch)) { if (value === undefined) { delete currentSlot[sectionID]; + } else { + currentSlot[sectionID] = value; } - - currentSlot[sectionID] = value; } + + this.fire({ [slotID]: currentSlot }); } } diff --git a/package.json b/package.json index 6b06bef1..d02f2ca1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paperlib-beta", - "version": "3.0.0-beta.2", + "version": "3.0.0-beta.3", "main": "dist/main-entry.js", "description": "A simple academic paper management tool.", "author": "Future Scholars ",