From 4bd920d6cf45618ccad0dc319d8394b86077a26a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Wed, 13 Nov 2024 19:18:36 +0100 Subject: [PATCH] fix(core): Unload any existing version of a community node before upgrading it --- .../services/__tests__/community-packages.service.test.ts | 6 ++++++ packages/cli/src/services/community-packages.service.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/packages/cli/src/services/__tests__/community-packages.service.test.ts b/packages/cli/src/services/__tests__/community-packages.service.test.ts index df4591cd08afc..7298e73a630ca 100644 --- a/packages/cli/src/services/__tests__/community-packages.service.test.ts +++ b/packages/cli/src/services/__tests__/community-packages.service.test.ts @@ -410,6 +410,12 @@ describe('CommunityPackagesService', () => { expect.any(Object), expect.any(Function), ); + expect(loadNodesAndCredentials.unloadPackage).toHaveBeenCalledWith( + installedPackage.packageName, + ); + expect(loadNodesAndCredentials.loadPackage).toHaveBeenCalledWith( + installedPackage.packageName, + ); }); test('should throw when not licensed', async () => { diff --git a/packages/cli/src/services/community-packages.service.ts b/packages/cli/src/services/community-packages.service.ts index 4906a6ef33cbe..9f09d0c310def 100644 --- a/packages/cli/src/services/community-packages.service.ts +++ b/packages/cli/src/services/community-packages.service.ts @@ -354,6 +354,7 @@ export class CommunityPackagesService { let loader: PackageDirectoryLoader; try { + await this.loadNodesAndCredentials.unloadPackage(packageName); loader = await this.loadNodesAndCredentials.loadPackage(packageName); } catch (error) { // Remove this package since loading it failed