-
-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove redundant, stringly-typed fields from PmConversationData #4116
Closed
rk-for-zulip
wants to merge
16
commits into
zulip:master
from
rk-for-zulip:downstream-nonsense-first
+210
−241
Closed
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b709601
selectors [nfc]: Rename some variables, mostly for clarity.
rk-for-zulip d3da775
narrow [nfc]: Add some documentation for `groupNarrow`.
rk-for-zulip b19dc56
types: Remove all exactness from MessagesState.
rk-for-zulip 288b360
example data [nfc]: Allow specifying `user_id` when making a user.
rk-for-zulip f82b9ff
example data: Add auxiliary function `pmMessageFromTo`.
rk-for-zulip 1e6668f
example data: Add auxiliary function `makeMessagesState`.
rk-for-zulip b80309a
tests: Properly type pmConversationsSelectors-test.js.
rk-for-zulip 1377fa2
types [nfc]: Add jsdoc for the fields of PmConversationData.
rk-for-zulip 75bf388
recent convs: Add `users` field to `PmConversationData`.
rk-for-zulip fd5d315
pm UI [nfc]: Connect `PmConversationList` to Redux directly.
rk-for-zulip f0311ce
recipient.js: Add replacement helper function.
rk-for-zulip 7cc45cd
pm UI: Convert `GroupPmConversationItem` to use `users`.
rk-for-zulip 3cd885b
pm UI: Finish converting `PmConversationList` to use `users`.
rk-for-zulip c3c9660
types [nfc]: Remove `ids` and `recipients` from `PmConversationData`.
rk-for-zulip 6b52ada
recent convs: Remove `recipients` from internal structure.
rk-for-zulip f371f09
recipient.js: Remove `normalizeRecipientsSansMe`.
rk-for-zulip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
types: Remove all exactness from MessagesState.
MessagesState is exact; until Flow v0.111.0, this is not usefully compatible with indexer properties. This exactness was added in 8370002, as part of a mechanical transformation, before we were aware of this issue. MessagesState also has `$Exact<Message>` as its indexer value type, rather than simply `Message`. This is the only use of `$Exact<...>` directly as the type of a value in our codebase; it was added in commit 01003e6, a professedly experimental commit, where it is the only such change among several less interesting `{ ... }` → `{| ... |}` conversions. Revert both. Add a note about the former and Flow v0.111.0, for grep's sake.
commit b19dc561a9a273b6d54ffddc82738f1279ea54ce
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of removing exactness here, why not add it on
Message
itself? (And remove the then-redundant mention of it here.)Otherwise we're regressing on how tightly we type-check.
For a quick experiment I made
Message
exact. Flow reported only one error -- and in fact it looks like a real one, which would have been caught in 3dc2d8f if we'd hadMessage
exact then.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message
really isn't exact, though: it's full of unlisted fields from (possibly future versions of) the server. We shouldn't make the claim that it is. (The bug you cite is a good argument thateg.streamMessage
and friends should take$Exact<Message>
, though.)I assume what we really want to do is to deconstruct the inexact, server-supplied
ApiMessage
object (to coin a name) into a freshLocalMessage
object that really is exact. But not, I think, today.(I'm pretty sure this has come up before. I know I've documented it in
Message
at some point, but I suppose that hasn't made it into a PR yet. I'll try to dig it up and submit it separately. Or just rewrite it.)