mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-10 09:02:50 +00:00
client - don't show no threads message until after load
This commit is contained in:
@@ -20,6 +20,7 @@ interface Props extends RouteComponentProps<any> {
|
|||||||
interface State {
|
interface State {
|
||||||
showEditor: boolean;
|
showEditor: boolean;
|
||||||
threads: ThreadModel[];
|
threads: ThreadModel[];
|
||||||
|
threadsLoaded: boolean;
|
||||||
initialThreads: ThreadModel[];
|
initialThreads: ThreadModel[];
|
||||||
pageThreads: ThreadModel[];
|
pageThreads: ThreadModel[];
|
||||||
pageLinks: (number | string)[];
|
pageLinks: (number | string)[];
|
||||||
@@ -51,6 +52,7 @@ export class Forum extends React.Component<Props, State> {
|
|||||||
this.state = {
|
this.state = {
|
||||||
showEditor: false,
|
showEditor: false,
|
||||||
threads: [],
|
threads: [],
|
||||||
|
threadsLoaded: false,
|
||||||
initialThreads: [],
|
initialThreads: [],
|
||||||
pageThreads: [],
|
pageThreads: [],
|
||||||
pageLinks: [],
|
pageLinks: [],
|
||||||
@@ -87,7 +89,7 @@ export class Forum extends React.Component<Props, State> {
|
|||||||
let threads = await ThreadService.getCategoryThreads(categoryId);
|
let threads = await ThreadService.getCategoryThreads(categoryId);
|
||||||
// remove hidden threads from normal users
|
// remove hidden threads from normal users
|
||||||
threads = reject(threads, t => !this.props.userStore.isModOrAdmin() && t.hidden);
|
threads = reject(threads, t => !this.props.userStore.isModOrAdmin() && t.hidden);
|
||||||
this.setState({ initialThreads: threads });
|
this.setState({ initialThreads: threads, threadsLoaded: true });
|
||||||
this.processThreads(threads);
|
this.processThreads(threads);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,9 +324,12 @@ export class Forum extends React.Component<Props, State> {
|
|||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { threads, threadsLoaded } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: '0 3px' }}>
|
<div style={{ padding: '0 3px' }}>
|
||||||
{this.state.threads.length > 0 ? table : noThreadsMessage}
|
{threadsLoaded && threads.length < 1 ? noThreadsMessage : table }
|
||||||
<div className="forumliner-bot-bg"/>
|
<div className="forumliner-bot-bg"/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user