Skip to content

msglist [nfc]: Convert the wrapper HOCs to more Hooks#5544

Merged
gnprice merged 8 commits intozulip:mainfrom
gnprice:pr-msglist-hooks-more
Nov 11, 2022
Merged

msglist [nfc]: Convert the wrapper HOCs to more Hooks#5544
gnprice merged 8 commits intozulip:mainfrom
gnprice:pr-msglist-hooks-more

Conversation

@gnprice
Copy link
Copy Markdown
Member

@gnprice gnprice commented Nov 10, 2022

This follows up on #5524 by replacing the various props-providing higher-order components we have wrapping this component -- connect, connectActionSheet, withGetText -- with just more hooks. MessageList is now simply a function component, rather than a series of wrappers around an inner function component.

As a bonus, we clean up a pair of calls to assumeSecretlyGlobalState.

Like #5524, this is on the road to #5364.

@gnprice gnprice added a-message list P1 high-priority server release goal Things we should try to coordinate with a major Zulip Server release. labels Nov 10, 2022
Copy link
Copy Markdown
Contributor

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Just one tiny comment comment below; please merge at will after seeing that.

Comment on lines +67 to +93
/**
* All the data for rendering the message list, and callbacks for its UI actions.
*
* This data gets used for rendering the initial HTML, for computing
* inbound-events to update the page. Then the handlers for the message
* list's numerous UI actions -- both for user interactions inside the page
* as represented by outbound-events, and in action sheets -- use the data
* and callbacks in order to do their jobs.
*
* This is also -- hence the name -- the React props for the inner, function
* component, which include data obtained through the various HOCs below.
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 * This data gets used for rendering the initial HTML, for computing
 * inbound-events to update the page. […]

Should the comma be replaced with "and"? It looks like this might've started its life as "A, B, and C" but then you removed ", and C". Is that right? 😛

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah, indeed. I think C was what turned into the separate next sentence.

@gnprice
Copy link
Copy Markdown
Member Author

gnprice commented Nov 11, 2022

Thanks for the review! Fixing that nit and will merge.

This "middle-props" notion will be temporary for within this series
of refactoring commits, to manage having a mix of some items provided
by HOCs and others by Hooks.
This originally described the props supplied by our callback passed
to `connect`.  Now that everything's just one big function component,
that's no longer such a meaningful distinction.
@gnprice gnprice force-pushed the pr-msglist-hooks-more branch from 20a9886 to 8383a3e Compare November 11, 2022 01:29
@gnprice gnprice merged commit 8383a3e into zulip:main Nov 11, 2022
@gnprice gnprice deleted the pr-msglist-hooks-more branch November 11, 2022 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a-message list P1 high-priority server release goal Things we should try to coordinate with a major Zulip Server release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants