Skip to content

Commit 2130a04

Browse files
committed
msglist [nfc]: Clean up scaffolding from folding in the wrappers
1 parent 1237d1d commit 2130a04

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/webview/MessageList.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import SinglePageWebView from './SinglePageWebView';
4343
import { usePrevious } from '../reactUtils';
4444

4545
/**
46-
* The actual React props for the exported MessageList component.
46+
* The actual React props for the MessageList component.
4747
*/
4848
type OuterProps = $ReadOnly<{|
4949
narrow: Narrow,
@@ -66,16 +66,6 @@ type SelectorProps = {|
6666
doNotMarkMessagesAsRead: boolean,
6767
|};
6868

69-
/**
70-
* The React props for the function component MessageListInner.
71-
*
72-
* These consist of OuterProps plus various props supplied by the HOC
73-
* wrappers below.
74-
*/
75-
type MiddleProps = $ReadOnly<{|
76-
...OuterProps,
77-
|}>;
78-
7969
/**
8070
* All the data for rendering the message list, and callbacks for its UI actions.
8171
*
@@ -88,10 +78,10 @@ type MiddleProps = $ReadOnly<{|
8878
* This can be thought of -- hence the name -- as the React props for a
8979
* notional inner component, like we'd have if we obtained this data through
9080
* HOCs like `connect` and `withGetText`. (Instead, we use Hooks, and don't
91-
* have an inner component with this set of props.)
81+
* have a separate inner component.)
9282
*/
9383
export type Props = $ReadOnly<{|
94-
...MiddleProps,
84+
...OuterProps,
9585

9686
dispatch: Dispatch,
9787
...SelectorProps,
@@ -166,7 +156,7 @@ function getSelectorProps(state, props) {
166156
};
167157
}
168158

169-
function useMessageListProps(outerProps: MiddleProps): Props {
159+
function useMessageListProps(outerProps: OuterProps): Props {
170160
const _ = useContext(TranslationContext);
171161
const showActionSheetWithOptions: ShowActionSheetWithOptions =
172162
useActionSheet().showActionSheetWithOptions;
@@ -232,7 +222,7 @@ const webviewAssetsUrl = new URL('webview/', assetsUrl);
232222
*/
233223
const baseUrl = new URL('index.html', webviewAssetsUrl);
234224

235-
function MessageListInner(outerProps: MiddleProps) {
225+
export default function MessageList(outerProps: OuterProps): React.Node {
236226
// NOTE: This component has an unusual lifecycle for a React component!
237227
//
238228
// In the React element which this render function returns, the bulk of
@@ -392,8 +382,3 @@ function MessageListInner(outerProps: MiddleProps) {
392382
/>
393383
);
394384
}
395-
396-
// TODO next steps: merge these wrappers into function, one at a time.
397-
const MessageList: React.ComponentType<OuterProps> = MessageListInner;
398-
399-
export default MessageList;

0 commit comments

Comments
 (0)