diff --git a/backend/packages/Upgrade/src/api/repositories/FeatureFlagRepository.ts b/backend/packages/Upgrade/src/api/repositories/FeatureFlagRepository.ts index 30b25dbff6..0176b73884 100644 --- a/backend/packages/Upgrade/src/api/repositories/FeatureFlagRepository.ts +++ b/backend/packages/Upgrade/src/api/repositories/FeatureFlagRepository.ts @@ -48,7 +48,7 @@ export class FeatureFlagRepository extends Repository { throw errorMsgString; }); - return result.raw; + return result.raw[0]; } public async updateFeatureFlag(flagDoc: Partial, entityManager: EntityManager): Promise { diff --git a/backend/packages/Upgrade/test/unit/repositories/FeatureFlagRepository.test.ts b/backend/packages/Upgrade/test/unit/repositories/FeatureFlagRepository.test.ts index 214b536164..9c26118b4a 100644 --- a/backend/packages/Upgrade/test/unit/repositories/FeatureFlagRepository.test.ts +++ b/backend/packages/Upgrade/test/unit/repositories/FeatureFlagRepository.test.ts @@ -173,7 +173,7 @@ describe('FeatureFlagRepository Testing', () => { sinon.assert.calledOnce(createQueryBuilderStub); updateMock.verify(); - expect(res).toEqual([flag]); + expect(res).toEqual(flag); }); it('should throw an error when update flag fails', async () => { diff --git a/frontend/projects/upgrade/src/app/core/feature-flags/store/feature-flags.reducer.ts b/frontend/projects/upgrade/src/app/core/feature-flags/store/feature-flags.reducer.ts index ed725f702c..6ab86bbb4b 100644 --- a/frontend/projects/upgrade/src/app/core/feature-flags/store/feature-flags.reducer.ts +++ b/frontend/projects/upgrade/src/app/core/feature-flags/store/feature-flags.reducer.ts @@ -86,7 +86,7 @@ const reducer = createReducer( isLoadingUpdateFeatureFlagStatus: true, })), on(FeatureFlagsActions.actionEnableFeatureFlagSuccess, (state, { response }) => { - const flag = response[0]; + const flag = response; return adapter.updateOne( { id: flag?.id, changes: { status: flag?.status } }, { ...state, isLoadingUpdateFeatureFlagStatus: false }