Skip to content

Commit

Permalink
🐛 [BUG] - Request count not getting updated (#1553)
Browse files Browse the repository at this point in the history
* fix: add min-height

* fix: stop count for push bot

* fix: add pushbot chat id, or active id

* fix conflicts
  • Loading branch information
corlard3y authored May 23, 2024
1 parent 49222ca commit 9660c4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/modules/chat/ChatModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ function Chat({ chatid }) {
<ChatSidebarSection
key={userPushSDKInstance.uid}
showCreateGroupModal={showCreateGroupModal}
chatId={chatid}
selectedChatId={selectedChatId}
setSelectedChatId={setSelectedChatId}
/>
</ChatSidebarContainer>
Expand Down
13 changes: 11 additions & 2 deletions src/sections/chat/ChatSidebarSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import { Context } from 'modules/chat/ChatModule';

// Internal Configs
import GLOBALS, { device } from 'config/Globals';
import { GlobalContext } from 'contexts/GlobalContext';
import { useAccount } from 'hooks';
import { appConfig } from '../../config/index.js';
import RecommendedChatLists from 'config/RecommendedChatsList';

const createGroupOnMouseEnter = [
{
Expand Down Expand Up @@ -51,7 +55,7 @@ type loadingData = { loading: boolean; preload: boolean; paging: boolean; finish

// Chat Sections
// Divided into two, left and right
const ChatSidebarSection = ({ showCreateGroupModal, setSelectedChatId }) => {
const ChatSidebarSection = ({ showCreateGroupModal, chatId, selectedChatId, setSelectedChatId }) => {
// theme context
const theme = useTheme();

Expand Down Expand Up @@ -359,7 +363,12 @@ const ChatSidebarSection = ({ showCreateGroupModal, setSelectedChatId }) => {
}}
onChatsCountChange={(count) => {
console.debug('src::sections::chat::ChatSidebarSection::onChatsCountChage::requests: count is: ', count);
setNumberOfChatReqs(count);
// remove request badge update when chatId is Push Bot or actively opened
if (chatId == RecommendedChatLists[0]?.payload?.chatId || chatId?.split("chatid:")[1] == selectedChatId){
setNumberOfChatReqs(null);
} else {
setNumberOfChatReqs(count);
}
}}
onLoading={(loadingData) => {
console.debug(
Expand Down

0 comments on commit 9660c4a

Please sign in to comment.