Skip to content

Commit

Permalink
fetchActions: Stop using tryUntilSuccessful in fetchPrivateMessages.
Browse files Browse the repository at this point in the history
`tryUntilSuccessful` is about to grow a timeout, which we've had in
mind in particular for the initial fetch. It's also about to be
moved into this file, and we want to keep its association with
`doInitialFetch` by putting it directly above it, with nothing in
between.

Removing this call site lets us do so without ESLint complaining of
`no-use-before-define`. And Greg says it's all the same to him [1],
especially since `fetchPrivateMessages` is doomed to be deleted
anyway, as the JSDoc says.

[1]: zulip#4165 (comment)
  • Loading branch information
chrisbobbe committed Jul 16, 2020
1 parent 664497b commit 8d00d2f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/message/fetchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,12 @@ export const fetchMessagesInNarrow = (
*/
const fetchPrivateMessages = () => async (dispatch: Dispatch, getState: GetState) => {
const auth = getAuth(getState());
const { messages, found_newest, found_oldest } = await tryUntilSuccessful(() =>
api.getMessages(auth, {
narrow: ALL_PRIVATE_NARROW,
anchor: LAST_MESSAGE_ANCHOR,
numBefore: 100,
numAfter: 0,
}),
);
const { messages, found_newest, found_oldest } = await api.getMessages(auth, {
narrow: ALL_PRIVATE_NARROW,
anchor: LAST_MESSAGE_ANCHOR,
numBefore: 100,
numAfter: 0,
});
dispatch(
messageFetchComplete({
messages,
Expand Down

0 comments on commit 8d00d2f

Please sign in to comment.