forked from Ivasoft/mattermost-mobile
Fixes (#6592)
This commit is contained in:
committed by
GitHub
parent
f874279d87
commit
dba66832a3
@@ -7,6 +7,7 @@ import {of as of$} from 'rxjs';
|
||||
import {switchMap} from 'rxjs/operators';
|
||||
|
||||
import {observeChannel} from '@queries/servers/channel';
|
||||
import {observePost} from '@queries/servers/post';
|
||||
import {observeUser} from '@queries/servers/user';
|
||||
|
||||
import Thread from './thread';
|
||||
@@ -15,7 +16,7 @@ import type {WithDatabaseArgs} from '@typings/database/database';
|
||||
import type ThreadModel from '@typings/database/models/servers/thread';
|
||||
|
||||
const enhanced = withObservables([], ({database, thread}: WithDatabaseArgs & {thread: ThreadModel}) => {
|
||||
const post = thread.post.observe();
|
||||
const post = observePost(database, thread.id);
|
||||
return {
|
||||
post,
|
||||
thread: thread.observe(),
|
||||
|
||||
@@ -142,6 +142,10 @@ const Thread = ({author, channel, location, post, teammateNameDisplay, testID, t
|
||||
}
|
||||
}, [isTablet, theme, thread]);
|
||||
|
||||
if (!post || !channel) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const threadStarterName = displayUsername(author, intl.locale, teammateNameDisplay);
|
||||
const threadItemTestId = `${testID}.thread_item.${thread.id}`;
|
||||
|
||||
@@ -219,7 +223,7 @@ const Thread = ({author, channel, location, post, teammateNameDisplay, testID, t
|
||||
<View style={styles.header}>
|
||||
<View style={styles.headerInfoContainer}>
|
||||
{name}
|
||||
{channel && threadStarterName !== channel?.displayName && (
|
||||
{threadStarterName !== channel?.displayName && (
|
||||
<View style={styles.channelNameContainer}>
|
||||
<Text
|
||||
style={styles.channelName}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import React, {useCallback, useEffect, useMemo, useState, useRef} from 'react';
|
||||
import {FlatList, ListRenderItemInfo, StyleSheet} from 'react-native';
|
||||
|
||||
import {fetchRefreshThreads, fetchThreads} from '@actions/remote/thread';
|
||||
import {fetchNewThreads, fetchRefreshThreads, fetchThreads} from '@actions/remote/thread';
|
||||
import Loading from '@components/loading';
|
||||
import {General, Screens} from '@constants';
|
||||
import {useServerUrl} from '@context/server';
|
||||
@@ -66,7 +66,7 @@ const ThreadsList = ({
|
||||
const lastThread = threads?.length > 0 ? threads[threads.length - 1] : null;
|
||||
|
||||
useEffect(() => {
|
||||
// this is to be called only when there are no threads
|
||||
// This is to be called only when there are no threads
|
||||
if (tab === 'all' && noThreads && !hasFetchedOnce.current) {
|
||||
setIsLoading(true);
|
||||
fetchThreads(serverUrl, teamId).finally(() => {
|
||||
@@ -74,7 +74,14 @@ const ThreadsList = ({
|
||||
setIsLoading(false);
|
||||
});
|
||||
}
|
||||
}, [noThreads, tab]);
|
||||
}, [noThreads, serverUrl, tab]);
|
||||
|
||||
useEffect(() => {
|
||||
// This is to be called when threads already exist locally and to fetch the latest threads
|
||||
if (!noThreads) {
|
||||
fetchNewThreads(serverUrl, teamId);
|
||||
}
|
||||
}, [noThreads, serverUrl, teamId]);
|
||||
|
||||
const listEmptyComponent = useMemo(() => {
|
||||
if (isLoading) {
|
||||
|
||||
Reference in New Issue
Block a user