From 2054e4bc11f2939661542992b44d5cc912e2460b Mon Sep 17 00:00:00 2001 From: hudy9x Date: Tue, 5 Mar 2024 16:55:00 +0700 Subject: [PATCH] fix(pin): can not pin project as user's setting is {} --- packages/shared-models/src/lib/projectPin.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/shared-models/src/lib/projectPin.ts b/packages/shared-models/src/lib/projectPin.ts index 90249772..9fb2e487 100644 --- a/packages/shared-models/src/lib/projectPin.ts +++ b/packages/shared-models/src/lib/projectPin.ts @@ -43,14 +43,12 @@ const _updatePinSetting = async ({ if (!user) return - let settings = user.settings as unknown as UserSetting + const settings = user.settings as unknown as UserSetting // set a default setting for pinned projects console.log('settings', settings) - if (type === 'pin' && !settings) { - settings = { - pinnedProjects: [] - } + if (type === 'pin' && !settings.pinnedProjects) { + settings.pinnedProjects = [] } if (!settings || !settings.pinnedProjects) {