Skip to content

Commit 7208ed0

Browse files
committed
connect: Convert remaining error sites to use "fixme" version.
These are the call sites that show type errors when we switch to the upcoming improved `connect` type that lets the type-checker work. Done mechanically. While on a version where `connect` had the improved type, ran the following command: $ node_modules/.bin/flow status --json \ | jq -r ' .errors | map(.message[0].loc.source)[] ' \ | sort -u \ | xargs -r perl -i -0pe ' s/\bconnect\b/connectFlowFixMe/g ' where the first few steps of the pipeline identify exactly the files where Flow is reporting errors. Then reviewed the diff and fixed up by hand the one place (in RealmScreen) where the word "connect" appeared as a false positive.
1 parent fb3f71b commit 7208ed0

13 files changed

+26
-26
lines changed

src/account-info/AccountDetailsScreen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
33
import { StyleSheet } from 'react-native';
44

55
import type { Dispatch, GlobalState, User } from '../types';
6-
import { connect } from '../react-redux';
6+
import { connectFlowFixMe } from '../react-redux';
77
import { getAccountDetailsUserFromEmail } from '../selectors';
88
import { Screen, ZulipButton } from '../common';
99
import { IconPrivateChat } from '../common/Icons';
@@ -52,6 +52,6 @@ class AccountDetailsScreen extends PureComponent<Props> {
5252
}
5353
}
5454

55-
export default connect((state: GlobalState, props) => ({
55+
export default connectFlowFixMe((state: GlobalState, props) => ({
5656
user: getAccountDetailsUserFromEmail(state, props.navigation.state.params.email),
5757
}))(AccountDetailsScreen);

src/autocomplete/TopicAutocomplete.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { PureComponent } from 'react';
44
import { FlatList, StyleSheet } from 'react-native';
55

66
import type { GlobalState, Dispatch } from '../types';
7-
import { connect } from '../react-redux';
7+
import { connectFlowFixMe } from '../react-redux';
88
import { getTopicsForNarrow } from '../selectors';
99
import { Popup, RawLabel, Touchable } from '../common';
1010
import AnimatedScaleComponent from '../animation/AnimatedScaleComponent';
@@ -55,6 +55,6 @@ class TopicAutocomplete extends PureComponent<Props> {
5555
}
5656
}
5757

58-
export default connect((state: GlobalState, props) => ({
58+
export default connectFlowFixMe((state: GlobalState, props) => ({
5959
topics: getTopicsForNarrow(props.narrow)(state),
6060
}))(TopicAutocomplete);

src/common/ZulipStatusBar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Platform, StatusBar, View } from 'react-native';
55
import Color from 'color';
66

77
import type { Dimensions, GlobalState, Narrow, Orientation, ThemeName, Dispatch } from '../types';
8-
import { connect } from '../react-redux';
8+
import { connectFlowFixMe } from '../react-redux';
99
import { DEFAULT_TITLE_BACKGROUND_COLOR, getTitleBackgroundColor } from '../title/titleSelectors';
1010
import { foregroundColorFromBackground } from '../utils/color';
1111
import { getSession, getSettings } from '../selectors';
@@ -66,7 +66,7 @@ class ZulipStatusBar extends PureComponent<Props> {
6666
}
6767
}
6868

69-
export default connect(
69+
export default connectFlowFixMe(
7070
(state: GlobalState, props: { backgroundColor?: string, narrow?: Narrow }) => ({
7171
safeAreaInsets: getSession(state).safeAreaInsets,
7272
theme: getSettings(state).theme,

src/message/NotSubscribed.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { PureComponent } from 'react';
44
import { View } from 'react-native';
55

66
import type { Auth, Stream, Dispatch } from '../types';
7-
import { connect } from '../react-redux';
7+
import { connectFlowFixMe } from '../react-redux';
88
import { subscriptionAdd } from '../api';
99
import { ZulipButton, Label } from '../common';
1010
import { getAuth, getStreamInNarrow } from '../selectors';
@@ -40,7 +40,7 @@ class NotSubscribed extends PureComponent<Props> {
4040
}
4141
}
4242

43-
export default connect((state, props) => ({
43+
export default connectFlowFixMe((state, props) => ({
4444
auth: getAuth(state),
4545
stream: getStreamInNarrow(props.narrow)(state),
4646
}))(NotSubscribed);

src/start/RealmScreen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ScrollView, Keyboard } from 'react-native';
44
import type { NavigationScreenProp } from 'react-navigation';
55

66
import type { ApiResponseServerSettings, Dispatch } from '../types';
7-
import { connect } from '../react-redux';
7+
import { connectFlowFixMe } from '../react-redux';
88
import { ErrorMsg, Label, SmartUrlInput, Screen, ZulipButton } from '../common';
99
import { isValidUrl } from '../utils/url';
1010
import { getServerSettings } from '../api';
@@ -95,7 +95,7 @@ class RealmScreen extends PureComponent<Props, State> {
9595
}
9696
}
9797

98-
export default connect((state, props) => ({
98+
export default connectFlowFixMe((state, props) => ({
9999
initialRealm:
100100
(props.navigation && props.navigation.state.params && props.navigation.state.params.realm)
101101
|| '',

src/streams/EditStreamScreen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, { PureComponent } from 'react';
33

44
import type { Dispatch, GlobalState, Stream } from '../types';
5-
import { connect } from '../react-redux';
5+
import { connectFlowFixMe } from '../react-redux';
66
import { updateExistingStream, navigateBack } from '../actions';
77
import { getStreamFromId } from '../selectors';
88
import { Screen } from '../common';
@@ -36,6 +36,6 @@ class EditStreamScreen extends PureComponent<Props> {
3636
}
3737
}
3838

39-
export default connect((state: GlobalState, props) => ({
39+
export default connectFlowFixMe((state: GlobalState, props) => ({
4040
stream: getStreamFromId(state, props.navigation.state.params.streamId),
4141
}))(EditStreamScreen);

src/streams/InviteUsersScreen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, { PureComponent } from 'react';
33

44
import type { Auth, Dispatch, GlobalState, Stream, User } from '../types';
5-
import { connect } from '../react-redux';
5+
import { connectFlowFixMe } from '../react-redux';
66
import { Screen } from '../common';
77
import { navigateBack } from '../actions';
88
import { subscriptionAdd } from '../api';
@@ -44,7 +44,7 @@ class InviteUsersScreen extends PureComponent<Props, State> {
4444
}
4545
}
4646

47-
export default connect((state: GlobalState, props) => ({
47+
export default connectFlowFixMe((state: GlobalState, props) => ({
4848
auth: getAuth(state),
4949
stream: getStreamFromId(state, props.navigation.state.params.streamId),
5050
}))(InviteUsersScreen);

src/streams/StreamScreen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
33
import { View } from 'react-native';
44

55
import type { Dispatch, GlobalState, Stream, Subscription } from '../types';
6-
import { connect } from '../react-redux';
6+
import { connectFlowFixMe } from '../react-redux';
77
import { delay } from '../utils/async';
88
import { OptionRow, Screen, ZulipButton, OptionDivider } from '../common';
99
import { getIsAdmin, getStreamFromId, getSubscriptionFromId } from '../selectors';
@@ -98,7 +98,7 @@ class StreamScreen extends PureComponent<Props> {
9898
}
9999
}
100100

101-
export default connect((state: GlobalState, props) => ({
101+
export default connectFlowFixMe((state: GlobalState, props) => ({
102102
isAdmin: getIsAdmin(state),
103103
stream: getStreamFromId(state, props.navigation.state.params.streamId),
104104
subscription: getSubscriptionFromId(state, props.navigation.state.params.streamId),

src/streams/SubscriptionsCard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { PureComponent } from 'react';
44
import { View, StyleSheet } from 'react-native';
55

66
import type { Dispatch, Narrow, Subscription, GlobalState } from '../types';
7-
import { connect } from '../react-redux';
7+
import { connectFlowFixMe } from '../react-redux';
88
import StreamList from './StreamList';
99
import { isStreamNarrow, streamNarrow } from '../utils/narrow';
1010
import { getUnreadByStream } from '../selectors';
@@ -47,7 +47,7 @@ class SubscriptionsCard extends PureComponent<Props> {
4747
}
4848
}
4949

50-
export default connect((state: GlobalState, props) => ({
50+
export default connectFlowFixMe((state: GlobalState, props) => ({
5151
narrow: props.narrow || [],
5252
// Main screen no longer contains drawer,
5353
// so at any position we cannot show selected stream in the list

src/title/ActivityText.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import React, { PureComponent } from 'react';
44

55
import type { Style, UserPresence, UserStatus, Dispatch } from '../types';
6-
import { connect } from '../react-redux';
6+
import { connectFlowFixMe } from '../react-redux';
77
import { getPresence, getUserStatus } from '../selectors';
88
import { presenceToHumanTime } from '../utils/presence';
99
import { RawLabel } from '../common';
@@ -29,7 +29,7 @@ class ActivityText extends PureComponent<Props> {
2929
}
3030
}
3131

32-
export default connect((state, props) => ({
32+
export default connectFlowFixMe((state, props) => ({
3333
presence: getPresence(state)[props.user.email],
3434
userStatus: getUserStatus(state)[props.user.user_id],
3535
}))(ActivityText);

src/title/TitleGroup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { PureComponent } from 'react';
44
import { StyleSheet, View } from 'react-native';
55

66
import type { Dispatch, UserOrBot } from '../types';
7-
import { connect } from '../react-redux';
7+
import { connectFlowFixMe } from '../react-redux';
88
import { UserAvatarWithPresence } from '../common';
99
import { getRecipientsInGroupNarrow } from '../selectors';
1010
import styles from '../styles';
@@ -47,6 +47,6 @@ class TitleGroup extends PureComponent<Props> {
4747
}
4848
}
4949

50-
export default connect((state, props) => ({
50+
export default connectFlowFixMe((state, props) => ({
5151
recipients: getRecipientsInGroupNarrow(state, props.narrow),
5252
}))(TitleGroup);

src/title/TitlePrivate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { PureComponent } from 'react';
44
import { StyleSheet, Text, View } from 'react-native';
55

66
import type { Dispatch, UserOrBot } from '../types';
7-
import { connect } from '../react-redux';
7+
import { connectFlowFixMe } from '../react-redux';
88
import { Touchable, UserAvatarWithPresence, ViewPlaceholder } from '../common';
99
import ActivityText from './ActivityText';
1010
import { getAllUsersByEmail } from '../users/userSelectors';
@@ -47,6 +47,6 @@ class TitlePrivate extends PureComponent<Props> {
4747
}
4848
}
4949

50-
export default connect((state, props) => ({
50+
export default connectFlowFixMe((state, props) => ({
5151
user: getAllUsersByEmail(state).get(props.email),
5252
}))(TitlePrivate);

src/topics/TopicListScreen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import React, { PureComponent } from 'react';
44

55
import type { Dispatch, GlobalState, Stream, TopicExtended } from '../types';
6-
import { connect } from '../react-redux';
6+
import { connectFlowFixMe } from '../react-redux';
77
import { Screen } from '../common';
88
import { topicNarrow } from '../utils/narrow';
99
import { getTopicsForStream } from '../selectors';
@@ -52,7 +52,7 @@ class TopicListScreen extends PureComponent<Props, State> {
5252
}
5353
}
5454

55-
export default connect((state: GlobalState, props) => ({
55+
export default connectFlowFixMe((state: GlobalState, props) => ({
5656
stream: getStreamFromId(state, props.navigation.state.params.streamId),
5757
topics: getTopicsForStream(state, props.navigation.state.params.streamId),
5858
}))(TopicListScreen);

0 commit comments

Comments
 (0)