Skip to content

Commit

Permalink
CW-2196 FIx loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
pvm-code committed Nov 16, 2023
1 parent 2e1f2f8 commit 6eefce9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import {
InternalLinkData,
DMChatMessage,
} from "@/shared/components";
import {
ChatType,
QueryParamKey,
} from "@/shared/constants";
import { ChatType, QueryParamKey } from "@/shared/constants";
import { useQueryParams } from "@/shared/hooks";
import {
checkIsUserDiscussionMessage,
Expand Down Expand Up @@ -217,7 +214,6 @@ const ChatContent: ForwardRefRenderFunction<
[scrollToContainerBottom],
);


return (
<>
{dateListReverse.map((day, dayIndex) => {
Expand Down
4 changes: 1 addition & 3 deletions src/shared/hooks/useCases/useDiscussionMessagesById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ export const useDiscussionMessagesById = ({

useEffect(() => {
(async () => {
setIsLoading(true);
const discussionMessages = [...(state.data || [])];
const filteredMessages = discussionMessages.filter(
({ moderation }) =>
Expand Down Expand Up @@ -310,13 +309,12 @@ export const useDiscussionMessagesById = ({
}));

setDiscussionMessagesWithOwners(loadedDiscussionMessages);
setIsLoading(false);
})();
}, [state.data, messageOwnersIds, messageOwners, hasPermissionToHide]);

return {
...state,
loading: state.loading || isLoading,
loading: state.loading,
data: discussionMessagesWithOwners,
isEndOfList,
fetchDiscussionMessages,
Expand Down

0 comments on commit 6eefce9

Please sign in to comment.