mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 12:51:18 +00:00
Adding limits to inbox fetching. Fixes #420
This commit is contained in:
parent
02344635db
commit
e636f3bca3
2 changed files with 13 additions and 22 deletions
15
ui/src/components/inbox.tsx
vendored
15
ui/src/components/inbox.tsx
vendored
|
@ -14,7 +14,7 @@ import {
|
||||||
CommentResponse,
|
CommentResponse,
|
||||||
} from '../interfaces';
|
} from '../interfaces';
|
||||||
import { WebSocketService, UserService } from '../services';
|
import { WebSocketService, UserService } from '../services';
|
||||||
import { msgOp } from '../utils';
|
import { msgOp, fetchLimit } from '../utils';
|
||||||
import { CommentNodes } from './comment-nodes';
|
import { CommentNodes } from './comment-nodes';
|
||||||
import { SortSelect } from './sort-select';
|
import { SortSelect } from './sort-select';
|
||||||
import { i18n } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
|
@ -58,14 +58,7 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
this.handleSortChange = this.handleSortChange.bind(this);
|
this.handleSortChange = this.handleSortChange.bind(this);
|
||||||
|
|
||||||
this.subscription = WebSocketService.Instance.subject
|
this.subscription = WebSocketService.Instance.subject
|
||||||
.pipe(
|
.pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
|
||||||
retryWhen(errors =>
|
|
||||||
errors.pipe(
|
|
||||||
delay(3000),
|
|
||||||
take(10)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.subscribe(
|
.subscribe(
|
||||||
msg => this.parseMessage(msg),
|
msg => this.parseMessage(msg),
|
||||||
err => console.error(err),
|
err => console.error(err),
|
||||||
|
@ -279,7 +272,7 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
sort: SortType[this.state.sort],
|
sort: SortType[this.state.sort],
|
||||||
unread_only: this.state.unreadOrAll == UnreadOrAll.Unread,
|
unread_only: this.state.unreadOrAll == UnreadOrAll.Unread,
|
||||||
page: this.state.page,
|
page: this.state.page,
|
||||||
limit: 9999,
|
limit: fetchLimit,
|
||||||
};
|
};
|
||||||
WebSocketService.Instance.getReplies(repliesForm);
|
WebSocketService.Instance.getReplies(repliesForm);
|
||||||
|
|
||||||
|
@ -287,7 +280,7 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
sort: SortType[this.state.sort],
|
sort: SortType[this.state.sort],
|
||||||
unread_only: this.state.unreadOrAll == UnreadOrAll.Unread,
|
unread_only: this.state.unreadOrAll == UnreadOrAll.Unread,
|
||||||
page: this.state.page,
|
page: this.state.page,
|
||||||
limit: 9999,
|
limit: fetchLimit,
|
||||||
};
|
};
|
||||||
WebSocketService.Instance.getUserMentions(userMentionsForm);
|
WebSocketService.Instance.getUserMentions(userMentionsForm);
|
||||||
}
|
}
|
||||||
|
|
20
ui/src/components/navbar.tsx
vendored
20
ui/src/components/navbar.tsx
vendored
|
@ -13,7 +13,12 @@ import {
|
||||||
GetSiteResponse,
|
GetSiteResponse,
|
||||||
Comment,
|
Comment,
|
||||||
} from '../interfaces';
|
} from '../interfaces';
|
||||||
import { msgOp, pictshareAvatarThumbnail, showAvatars } from '../utils';
|
import {
|
||||||
|
msgOp,
|
||||||
|
pictshareAvatarThumbnail,
|
||||||
|
showAvatars,
|
||||||
|
fetchLimit,
|
||||||
|
} from '../utils';
|
||||||
import { version } from '../version';
|
import { version } from '../version';
|
||||||
import { i18n } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
import { T } from 'inferno-i18next';
|
import { T } from 'inferno-i18next';
|
||||||
|
@ -56,14 +61,7 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.wsSub = WebSocketService.Instance.subject
|
this.wsSub = WebSocketService.Instance.subject
|
||||||
.pipe(
|
.pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
|
||||||
retryWhen(errors =>
|
|
||||||
errors.pipe(
|
|
||||||
delay(3000),
|
|
||||||
take(10)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.subscribe(
|
.subscribe(
|
||||||
msg => this.parseMessage(msg),
|
msg => this.parseMessage(msg),
|
||||||
err => console.error(err),
|
err => console.error(err),
|
||||||
|
@ -241,14 +239,14 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
sort: SortType[SortType.New],
|
sort: SortType[SortType.New],
|
||||||
unread_only: true,
|
unread_only: true,
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 9999,
|
limit: fetchLimit,
|
||||||
};
|
};
|
||||||
|
|
||||||
let userMentionsForm: GetUserMentionsForm = {
|
let userMentionsForm: GetUserMentionsForm = {
|
||||||
sort: SortType[SortType.New],
|
sort: SortType[SortType.New],
|
||||||
unread_only: true,
|
unread_only: true,
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 9999,
|
limit: fetchLimit,
|
||||||
};
|
};
|
||||||
if (this.currentLocation !== '/inbox') {
|
if (this.currentLocation !== '/inbox') {
|
||||||
WebSocketService.Instance.getReplies(repliesForm);
|
WebSocketService.Instance.getReplies(repliesForm);
|
||||||
|
|
Loading…
Reference in a new issue