Skip to content

Commit cf7ada9

Browse files
committed
connect: Mass-migrate to our type-fixing wrapper.
This converts every reference to `connect` in our codebase to go through this wrapper, giving us an easy single point of control for the types Flow sees for `connect`. If in the future we start using other features of `connect` that the wrapper ignores, we can add them there; or add a second wrapper with a different name, if that happens to be easier. (No reason we have to rely as heavily on overloading as the upstream `connect` does.) Done mechanically, like so: $ perl -i -0pe ' s<^import \{ connect \} from .react-redux..\n> <>m || next; s<from .[./]*/types.;\n\K> <import { connect } from '\''../react-redux'\'';\n>ms; ' src/**/*.js
1 parent b58df60 commit cf7ada9

File tree

75 files changed

+75
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+75
-75
lines changed

src/account-info/AccountDetails.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import { View, StyleSheet } from 'react-native';
4-
import { connect } from 'react-redux';
54

65
import type { GlobalState, User, Dispatch } from '../types';
6+
import { connect } from '../react-redux';
77
import { UserAvatar, ComponentList, RawLabel } from '../common';
88
import { getCurrentRealm, getUserStatusTextForUser } from '../selectors';
99
import PresenceStatusIndicator from '../common/PresenceStatusIndicator';

src/account-info/AccountDetailsScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import { StyleSheet } from 'react-native';
4-
import { connect } from 'react-redux';
54

65
import type { Dispatch, GlobalState, User } from '../types';
6+
import { connect } from '../react-redux';
77
import { getAccountDetailsUserFromEmail } from '../selectors';
88
import { Screen, ZulipButton } from '../common';
99
import { IconPrivateChat } from '../common/Icons';

src/account-info/AwayStatusSwitch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
3-
import { connect } from 'react-redux';
43

54
import type { Dispatch, GlobalState } from '../types';
5+
import { connect } from '../react-redux';
66
import { OptionRow } from '../common';
77
import { getSelfUserAwayStatus } from '../selectors';
88
import { updateUserAwayStatus } from '../user-status/userStatusActions';

src/account-info/ProfileCard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import { ScrollView, StyleSheet, View } from 'react-native';
4-
import { connect } from 'react-redux';
54

65
import type { Dispatch, GlobalState, User } from '../types';
6+
import { connect } from '../react-redux';
77
import { getSelfUserDetail } from '../selectors';
88
import { ZulipButton } from '../common';
99
import {

src/account/AccountPickScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { StyleSheet } from 'react-native';
65

76
import type { Dispatch, GlobalState } from '../types';
7+
import { connect } from '../react-redux';
88
import { hasAuth, getAccountStatuses } from '../selectors';
99
import type { AccountStatus } from './accountsSelectors';
1010
import { Centerer, ZulipButton, Logo, Screen } from '../common';

src/autocomplete/EmojiAutocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { FlatList } from 'react-native';
@@ -8,6 +7,7 @@ import { Popup } from '../common';
87
import EmojiRow from '../emoji/EmojiRow';
98
import { getFilteredEmojiNames } from '../emoji/data';
109
import type { GlobalState, RealmEmojiById, Dispatch } from '../types';
10+
import { connect } from '../react-redux';
1111
import { getActiveImageEmojiByName } from '../selectors';
1212

1313
type Props = {|

src/autocomplete/PeopleAutocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { SectionList } from 'react-native';
65

76
import type { User, UserGroup, GlobalState, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { getOwnEmail, getSortedUsers, getUserGroups } from '../selectors';
99
import {
1010
getAutocompleteSuggestion,

src/autocomplete/StreamAutocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { FlatList } from 'react-native';
65

76
import type { GlobalState, SubscriptionsState, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { Popup } from '../common';
99
import { getSubscribedStreams } from '../subscriptions/subscriptionSelectors';
1010
import StreamItem from '../streams/StreamItem';

src/autocomplete/TopicAutocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { FlatList, StyleSheet } from 'react-native';
65

76
import type { GlobalState, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { getTopicsForNarrow } from '../selectors';
99
import { Popup, RawLabel, Touchable } from '../common';
1010
import AnimatedScaleComponent from '../animation/AnimatedScaleComponent';

src/boot/AppDataFetcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import { PureComponent } from 'react';
54

65
import type { Node as React$Node } from 'react';
76
import type { Dispatch, GlobalState } from '../types';
7+
import { connect } from '../react-redux';
88
import { getSession } from '../directSelectors';
99
import { doInitialFetch } from '../actions';
1010

src/boot/AppEventHandlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { AppState, NetInfo, View, StyleSheet, Platform, NativeModules } from 'react-native';
@@ -8,6 +7,7 @@ import Orientation from 'react-native-orientation';
87

98
import type { Node as React$Node } from 'react';
109
import type { Dispatch, GlobalState, Orientation as OrientationT } from '../types';
10+
import { connect } from '../react-redux';
1111
import { getUnreadByHuddlesMentionsAndPMs } from '../selectors';
1212
import { handleInitialNotification, NotificationListener } from '../notification';
1313
import {

src/boot/StylesProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54

65
import type { Node as React$Node } from 'react';
76
import type { GlobalState, ThemeName, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { getSettings } from '../directSelectors';
99
import { stylesFromTheme, themeColors, ThemeContext } from '../styles/theme';
1010

src/boot/TranslationProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32
import React, { PureComponent } from 'react';
43
import type { ComponentType, ElementConfig, Node as React$Node } from 'react';
54
import { Text } from 'react-native';
65
import { IntlProvider } from 'react-intl';
76
import type { IntlShape } from 'react-intl';
87

98
import type { GetText, GlobalState, Dispatch } from '../types';
9+
import { connect } from '../react-redux';
1010
import { getSettings } from '../selectors';
1111
import '../../vendor/intl/intl';
1212
import messages from '../i18n/messages';

src/chat/Chat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import { View, StyleSheet } from 'react-native';
4-
import { connect } from 'react-redux';
54

65
import type { GlobalState, Narrow, Dispatch } from '../types';
6+
import { connect } from '../react-redux';
77
import { KeyboardAvoider } from '../common';
88
import MessageList from '../webview/MessageList';
99
import NoMessages from '../message/NoMessages';

src/chat/GroupDetailsScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32
import React, { PureComponent } from 'react';
43
import { FlatList } from 'react-native';
54
import type { NavigationScreenProp } from 'react-navigation';
65

76
import type { Dispatch, UserOrBot } from '../types';
7+
import { connect } from '../react-redux';
88
import { Screen } from '../common';
99
import UserItem from '../users/UserItem';
1010
import { navigateToAccountDetails } from '../actions';

src/chat/MarkUnreadButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { StyleSheet } from 'react-native';
65

76
import type { Auth, GlobalState, Narrow, Stream, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { ZulipButton } from '../common';
99
import { markAllAsRead, markStreamAsRead, markTopicAsRead } from '../api';
1010
import { getAuth, getStreams } from '../selectors';

src/chat/UnreadNotice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { StyleSheet, View } from 'react-native';
65

76
import type { Narrow, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { getUnreadCountForNarrow } from '../selectors';
99
import { Label, RawLabel } from '../common';
1010
import { unreadToLimitedCount } from '../utils/unread';

src/common/OfflineNotice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { StyleSheet } from 'react-native';
65

76
import type { GlobalState, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { getSession } from '../selectors';
99
import Label from './Label';
1010

src/common/OwnAvatar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
3-
import { connect } from 'react-redux';
43

54
import type { GlobalState, User, Dispatch } from '../types';
5+
import { connect } from '../react-redux';
66
import { getCurrentRealm, getSelfUserDetail } from '../selectors';
77
import UserAvatar from './UserAvatar';
88
import { getAvatarFromUser } from '../utils/avatar';

src/common/PresenceStatusIndicator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/* eslint-disable react-native/no-unused-styles */
33
import React, { PureComponent } from 'react';
44
import { StyleSheet, View } from 'react-native';
5-
import { connect } from 'react-redux';
65

76
import type {
87
GlobalState,
@@ -12,6 +11,7 @@ import type {
1211
UserStatusMapObject,
1312
Dispatch,
1413
} from '../types';
14+
import { connect } from '../react-redux';
1515
import { statusFromPresenceAndUserStatus } from '../utils/presence';
1616
import { getPresence, getUserStatus } from '../selectors';
1717
import { getUsersByEmail } from '../users/userSelectors';

src/common/Screen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import type { Node as React$Node } from 'react';
65
import { StyleSheet, View, ScrollView } from 'react-native';
76

87
import type { Context, Dimensions, GlobalState, LocalizableText, Style, Dispatch } from '../types';
8+
import { connect } from '../react-redux';
99
import KeyboardAvoider from './KeyboardAvoider';
1010
import OfflineNotice from './OfflineNotice';
1111
import ZulipStatusBar from './ZulipStatusBar';

src/common/UserAvatarWithPresence.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { StyleSheet } from 'react-native';
65

76
import type { GlobalState, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { getCurrentRealm } from '../selectors';
99
import UserAvatar from './UserAvatar';
1010
import { getAvatarUrl } from '../utils/avatar';

src/common/WebLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { StyleSheet } from 'react-native';
65

76
import type { GlobalState, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import Label from './Label';
99
import { getFullUrl } from '../utils/url';
1010
import openLink from '../utils/openLink';

src/common/ZulipStatusBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { Platform, StatusBar, View } from 'react-native';
65
import Color from 'color';
76

87
import type { Dimensions, GlobalState, Narrow, Orientation, ThemeName, Dispatch } from '../types';
8+
import { connect } 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';

src/compose/ComposeBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import { Platform, View, TextInput, findNodeHandle } from 'react-native';
4-
import { connect } from 'react-redux';
54
import TextInputReset from 'react-native-text-input-reset';
65

76
import type {
@@ -15,6 +14,7 @@ import type {
1514
Dimensions,
1615
GlobalState,
1716
} from '../types';
17+
import { connect } from '../react-redux';
1818
import {
1919
addToOutbox,
2020
cancelEditMessage,

src/compose/ComposeMenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import React, { PureComponent } from 'react';
33
import { View } from 'react-native';
44
// $FlowFixMe
55
import ImagePicker from 'react-native-image-picker';
6-
import { connect } from 'react-redux';
76

87
import type { Dispatch, Narrow } from '../types';
8+
import { connect } from '../react-redux';
99
import { showErrorAlert } from '../utils/info';
1010
import styles from '../styles';
1111
import { IconPlus, IconLeft, IconPeople, IconImage, IconCamera } from '../common/Icons';

src/diagnostics/DiagnosticsScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { StyleSheet } from 'react-native';
65

76
import DeviceInfo from 'react-native-device-info';
87
import type { Dispatch } from '../types';
8+
import { connect } from '../react-redux';
99
import { OptionButton, OptionDivider, Screen, RawLabel } from '../common';
1010
import {
1111
navigateToDebug,

src/diagnostics/StorageScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { FlatList } from 'react-native';
65

76
import type { GlobalState, Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { Screen } from '../common';
99
import SizeItem from './SizeItem';
1010

src/emoji/EmojiPickerScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { FlatList } from 'react-native';
@@ -11,6 +10,7 @@ import { Screen } from '../common';
1110
import EmojiRow from './EmojiRow';
1211
import { getFilteredEmojiNames } from './data';
1312
import type { GlobalState, RealmEmojiById, Auth, Dispatch, ReactionType } from '../types';
13+
import { connect } from '../react-redux';
1414
import { getAuth, getActiveImageEmojiByName } from '../selectors';
1515
import { navigateBack } from '../nav/navActions';
1616
import zulipExtraEmojiMap from './zulipExtraEmojiMap';

src/emoji/EmojiRow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
3-
import { connect } from 'react-redux';
43
import { StyleSheet, View } from 'react-native';
54

65
import type { GlobalState, ImageEmojiType, Dispatch } from '../types';
6+
import { connect } from '../react-redux';
77
import { RawLabel, Touchable } from '../common';
88
import Emoji from './Emoji';
99
import ImageEmoji from './ImageEmoji';

src/lightbox/Lightbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { View, StyleSheet, Dimensions, Easing } from 'react-native';
65
import PhotoView from 'react-native-photo-view';
76
import { connectActionSheet } from '@expo/react-native-action-sheet';
87

98
import type { Auth, Dispatch, GlobalState, Message } from '../types';
9+
import { connect } from '../react-redux';
1010
import type { ShowActionSheetWithOptions } from '../message/messageActionSheet';
1111
import { getAuth } from '../selectors';
1212
import { getResource } from '../utils/url';

src/main/HomeTab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow strict-local */
2-
import { connect } from 'react-redux';
32

43
import React, { PureComponent } from 'react';
54
import { StyleSheet, View } from 'react-native';
65

76
import type { Dispatch } from '../types';
7+
import { connect } from '../react-redux';
88
import { HOME_NARROW, MENTIONED_NARROW, STARRED_NARROW } from '../utils/narrow';
99
import NavButton from '../nav/NavButton';
1010
import UnreadCards from '../unread/UnreadCards';

0 commit comments

Comments
 (0)