Skip to content

Commit

Permalink
Merge branch 'epic-base' into deploy/epic
Browse files Browse the repository at this point in the history
  • Loading branch information
samchuk-vlad committed Jul 18, 2024
2 parents e031acb + e91579b commit 44bc94a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
15 changes: 10 additions & 5 deletions src/components/chats/hooks/usePaginatedMessageIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ export default function usePaginatedMessageIds({
const myAddress = useMyMainAddress() ?? ''
// because from server it doesn't have access to myAddress, so we need to use the data without users' unapproved posts as placeholder
const { data: placeholderData } =
getPaginatedPostIdsByPostId.useInfiniteQuery({
postId: chatId,
onlyDisplayUnapprovedMessages: !!onlyDisplayUnapprovedMessages,
myAddress: '',
})
getPaginatedPostIdsByPostId.useInfiniteQuery(
{
postId: chatId,
onlyDisplayUnapprovedMessages: !!onlyDisplayUnapprovedMessages,
myAddress: '',
},
{
enabled: false,
}
)
const { data, fetchNextPage, isLoading } =
getPaginatedPostIdsByPostId.useInfiniteQuery(
{
Expand Down
6 changes: 1 addition & 5 deletions src/pages/tg/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ import { getProfilesServer } from '../api/profiles'
async function prefetchChatData(client: QueryClient, chatId: string) {
if (!chatId) return

// as now this query without myAddress is only used as placeholder data, no need to invalidate it
const firstPageData = await getPaginatedPostIdsByPostId.fetchFirstPageQuery(
client,
{ postId: chatId, onlyDisplayUnapprovedMessages: false, myAddress: '' },
1
)
getPaginatedPostIdsByPostId.invalidateFirstQuery(client, {
postId: chatId,
onlyDisplayUnapprovedMessages: false,
myAddress: '',
})
const ownerIds = firstPageData.data
.map((id) => {
const post = getPostQuery.getQueryData(client, id)
Expand Down

0 comments on commit 44bc94a

Please sign in to comment.