Skip to content

Commit 400f4ac

Browse files
borisyankovgnprice
authored andcommitted
outbox: Remove not needed sendOutbox on connectivity change.
Now that we are retrying on failed message send we are handling all possible cases where we might end up with unsent messages: * if message send fails immediately (we keep retrying) * if the app was closed with unsent messages (we try again on next launch, inside `doInitialFetch` -- and keep retrying) The connectivity change was a good heuristic with the imperfect retry strategy but is not needed any more.
1 parent f00dce5 commit 400f4ac

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/boot/AppEventHandlers.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ import type {
1313
Orientation as OrientationT,
1414
UserIdMap,
1515
} from '../types';
16-
import { getSession, getUnreadByHuddlesMentionsAndPMs, getUsersById } from '../selectors';
16+
import { getUnreadByHuddlesMentionsAndPMs, getUsersById } from '../selectors';
1717
import { handleInitialNotification, NotificationListener } from '../notification';
1818
import {
1919
appOnline,
2020
appOrientation,
2121
appState,
2222
initSafeAreaInsets,
2323
reportPresence,
24-
sendOutbox,
2524
} from '../actions';
2625

2726
const componentStyles = StyleSheet.create({
@@ -33,7 +32,6 @@ const componentStyles = StyleSheet.create({
3332
});
3433

3534
type Props = {|
36-
needsInitialFetch: boolean,
3735
dispatch: Dispatch,
3836
children: ChildrenArray<*>,
3937
unreadCount: number,
@@ -47,12 +45,9 @@ class AppEventHandlers extends PureComponent<Props> {
4745
};
4846

4947
handleConnectivityChange = connectionInfo => {
50-
const { dispatch, needsInitialFetch } = this.props;
48+
const { dispatch } = this.props;
5149
const isConnected = connectionInfo.type !== 'none' && connectionInfo.type !== 'unknown';
5250
dispatch(appOnline(isConnected));
53-
if (!needsInitialFetch && isConnected) {
54-
dispatch(sendOutbox());
55-
}
5651
};
5752

5853
handleAppStateChange = state => {
@@ -100,7 +95,6 @@ class AppEventHandlers extends PureComponent<Props> {
10095
}
10196

10297
export default connect((state: GlobalState) => ({
103-
needsInitialFetch: getSession(state).needsInitialFetch,
10498
usersById: getUsersById(state),
10599
unreadCount: getUnreadByHuddlesMentionsAndPMs(state),
106100
}))(AppEventHandlers);

0 commit comments

Comments
 (0)