From b8838516429740e178a43e3f600b43b4e9469962 Mon Sep 17 00:00:00 2001 From: Alexandre Anicio Date: Tue, 10 Dec 2024 15:23:13 -0300 Subject: [PATCH] BA-hotfix: remove listener --- packages/authentication/CHANGELOG.md | 7 ++++++- .../modules/profile/useCurrentProfile/index.ts | 11 ----------- packages/authentication/package.json | 2 +- packages/components/CHANGELOG.md | 7 +++++++ packages/components/package.json | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/authentication/CHANGELOG.md b/packages/authentication/CHANGELOG.md index 5863ef9b..1702aa19 100644 --- a/packages/authentication/CHANGELOG.md +++ b/packages/authentication/CHANGELOG.md @@ -1,5 +1,11 @@ # @baseapp-frontend/authentication +## 4.0.5 + +### Patch Changes + +- Remove `useEffect` hook that queues the logout listener. + ## 4.0.4 ### Patch Changes @@ -8,7 +14,6 @@ - Fix `useLogin` adding optional chaining to a problematic expression. - Move `InitialProfileProviderForTesting` around. - ## 4.0.3 ### Patch Changes diff --git a/packages/authentication/modules/profile/useCurrentProfile/index.ts b/packages/authentication/modules/profile/useCurrentProfile/index.ts index 7cda9312..91d7cbde 100644 --- a/packages/authentication/modules/profile/useCurrentProfile/index.ts +++ b/packages/authentication/modules/profile/useCurrentProfile/index.ts @@ -1,7 +1,5 @@ 'use client' -import { useCallback, useEffect } from 'react' - import { LOGOUT_EVENT, ServerSideRenderingOption, @@ -65,15 +63,6 @@ const useCurrentProfile = ({ noSSR = true }: ServerSideRenderingOption = {}) => } } - const removeCurrentProfile = useCallback(() => setCurrentProfile(null), []) - - useEffect(() => { - eventEmitter.on(LOGOUT_EVENT, removeCurrentProfile) - return () => { - eventEmitter.off(LOGOUT_EVENT, removeCurrentProfile) - } - }, []) - if (isSSR) { return { currentProfile: getProfileFromCookie({ noSSR }), diff --git a/packages/authentication/package.json b/packages/authentication/package.json index 20c41109..c9971a96 100644 --- a/packages/authentication/package.json +++ b/packages/authentication/package.json @@ -1,7 +1,7 @@ { "name": "@baseapp-frontend/authentication", "description": "Authentication modules.", - "version": "4.0.4", + "version": "4.0.5", "main": "./index.ts", "types": "dist/index.d.ts", "sideEffects": false, diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 859d9ce6..3e3b91ab 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -1,5 +1,12 @@ # @baseapp-frontend/components +## 0.0.26 + +### Patch Changes + +- Updated dependencies + - @baseapp-frontend/authentication@4.0.5 + ## 0.0.25 ### Patch Changes diff --git a/packages/components/package.json b/packages/components/package.json index ef1670b0..ee090e5b 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,7 +1,7 @@ { "name": "@baseapp-frontend/components", "description": "BaseApp components modules such as comments, notifications, messages, and more.", - "version": "0.0.25", + "version": "0.0.26", "main": "./index.ts", "types": "dist/index.d.ts", "sideEffects": false,