Skip to content

Commit

Permalink
Fixed copy util
Browse files Browse the repository at this point in the history
  • Loading branch information
MeyerPV committed Nov 20, 2024
1 parent efc2f2c commit 83a447a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default function AssignCircleModal({
commonActions.setRecentAssignedCircleByMember({
memberId,
circle: selectedCircle,
commonId,
}),
);

Expand Down
1 change: 0 additions & 1 deletion src/store/states/cache/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
ChatChannelUserStatus,
CirclesPermissions,
CommonFeedObjectUserUnique,
CommonMemberWithUserInfo,
CommonMember,
Discussion,
DiscussionMessage,
Expand Down
9 changes: 5 additions & 4 deletions src/store/states/cache/saga/copyFeedStateByCommonId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export function* copyFeedStateByCommonId({
payload: commonId,
}: ReturnType<typeof actions.copyFeedStateByCommonId>) {
const commonState = (yield select(selectCommonState)) as CommonState;
const specificCommonFeedItems = commonState.feedItems[commonId];
const data =
commonState.feedItems.data && commonState.feedItems.data.slice(0, 30);
specificCommonFeedItems.data && specificCommonFeedItems.data.slice(0, 30);
const feedItems = {
...commonState.feedItems,
...specificCommonFeedItems,
data,
loading: false,
hasMore: true,
Expand All @@ -27,8 +28,8 @@ export function* copyFeedStateByCommonId({
commonId,
state: {
feedItems,
pinnedFeedItems: commonState.pinnedFeedItems,
sharedFeedItem: commonState.sharedFeedItem,
pinnedFeedItems: commonState.pinnedFeedItems[commonId],
sharedFeedItem: commonState.sharedFeedItem[commonId],
},
}),
);
Expand Down
13 changes: 7 additions & 6 deletions src/store/states/cache/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LoadingState } from "@/shared/interfaces";
import { FeedItemFollowLayoutItem, LoadingState } from "@/shared/interfaces";
import {
ChatChannelUserStatus,
ChatMessage,
Expand All @@ -11,12 +11,13 @@ import {
Proposal,
User,
} from "@/shared/models";
import { CommonState } from "../common";
import { FeedItems, PinnedFeedItems } from "../common";

export type FeedState = Pick<
CommonState,
"feedItems" | "pinnedFeedItems" | "sharedFeedItem"
>;
export type FeedState = {
feedItems: FeedItems;
pinnedFeedItems: PinnedFeedItems;
sharedFeedItem: FeedItemFollowLayoutItem | null;
};

export interface CacheState {
userStates: Record<string, LoadingState<User | null>>;
Expand Down

0 comments on commit 83a447a

Please sign in to comment.