-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
Make state.narrows
an Immutable.Map.
#4187
Commits on Jul 21, 2020
-
libdefs: Prepare to edit
redux-mock-store
.In an upcoming commit, we'll change the Dispatch type in this libdef to play nicely with our async redux-thunk actions. I don't see an easy way to give the libdef the flexibility to give different types depending on what middleware is used, so, we hard-code it for ourselves, since we know we'll be using redux-thunk for the foreseeable future. This means we probably can't reasonably make a PR to FlowTyped, even though this is (surprisingly) one of the few libraries we use that does have a libdef hosted by FlowTyped. Ah, well. Here, we just move the file, delete the metadata at the top, and run our auto-formatting. [cherry-picked from zulip#4171]
Configuration menu - View commit details
-
Copy full SHA for 4ce92da - Browse repository at this point
Copy the full SHA 4ce92daView commit details -
libdefs: Copy new version of redux-mock-store libdef.
This version [1] is marked for a higher version of Flow than we're using now (v0.104 and above), but there aren't any errors on our Flow version (v0.98). So, take it. This gets us a particular change to the Dispatch type [2] that goes in the right direction...until we clobber it with our own Dispatch that accounts for async redux-thunk actions, I suppose. Ah well, there are a few minor changes that we might like to have, and this is a later version, so, might as well. [1]: https://github.com/flow-typed/flow-typed/blob/c4f47bdda/definitions/npm/redux-mock-store_v1.2.x/flow_v0.104.x-/redux-mock-store_v1.2.x.js [2]: flow-typed/flow-typed#3803 [cherry-picked from zulip#4171]
Configuration menu - View commit details
-
Copy full SHA for 967ddc7 - Browse repository at this point
Copy the full SHA 967ddc7View commit details -
libdefs: Hard-code redux-thunk support into redux-mock-store.
As foreshadowed in the preceding commits, we can't really expect a FlowTyped-hosted libdef to have the flexibility to give us the right types for Dispatch on the condition that we pass `thunk` as a piece of middleware. We're decidedly using `thunk`, so, hard-code support for it here by allowing dispatch to be called with a redux-thunk async action. We're pretty consistent with having correct types for such an action, so not much is lost by typing its arguments loosely as `Function, Function`, and from some attempts, it seems much easier than nailing down something exactly right. [cherry-picked from zulip#4171]
Configuration menu - View commit details
-
Copy full SHA for 660de30 - Browse repository at this point
Copy the full SHA 660de30View commit details -
mocks: Remove __mocks__/redux-mock-store.js.
It looks like this was added with the idea that we'd use it in more places than we actually have. It adds a slight bit of convenience; with this mock, we can avoid having to write `configureStore([thunk])` a bunch of times. But that's a very small amount of boilerplate. The mock doesn't seem to have any other purpose that might be part of a unit-testing strategy. Removing it makes it possible to use the libdef without contorting it more drastically than we already have. [cherry-picked from zulip#4171]
Configuration menu - View commit details
-
Copy full SHA for 0e55339 - Browse repository at this point
Copy the full SHA 0e55339View commit details -
test data: Well-type
navStateWithNarrow
; make more representative.The added fields were gleaned from a real-life example observed with `redux-logger`. [cherry-picked from zulip#4171]
Configuration menu - View commit details
-
Copy full SHA for bf11c24 - Browse repository at this point
Copy the full SHA bf11c24View commit details -
Configuration menu - View commit details
-
Copy full SHA for 03637c1 - Browse repository at this point
Copy the full SHA 03637c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 27e20aa - Browse repository at this point
Copy the full SHA 27e20aaView commit details -
narrowsReducer tests: Remove a test that won't type-check.
Flow won't allow these inputs (a GlobalState of `undefined`, or an action of `{}`).
Configuration menu - View commit details
-
Copy full SHA for 55d6461 - Browse repository at this point
Copy the full SHA 55d6461View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4077e88 - Browse repository at this point
Copy the full SHA 4077e88View commit details -
narrowsSelectors tests [nfc]: Remove confusing
expectedState
variab……les. `expectedState` makes sense in tests for reducers, but not really for selectors. The *input* of a selector is the GlobalState, but the output is...whatever we want to do with that input. Sometimes we just pick things directly from the state; sometimes we do that and then nudge it around until it's in a shape we want. Also rename `anchor` to the more general `result`; I'm not really sure what "anchor" is meant to refer to in each of these instances.
Configuration menu - View commit details
-
Copy full SHA for 5a99b21 - Browse repository at this point
Copy the full SHA 5a99b21View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3ecf445 - Browse repository at this point
Copy the full SHA 3ecf445View commit details -
Configuration menu - View commit details
-
Copy full SHA for cc837fb - Browse repository at this point
Copy the full SHA cc837fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7718c95 - Browse repository at this point
Copy the full SHA 7718c95View commit details -
exampleData: Export displayRecipientFromUser.
We'll use this in pmConversationsSelectors-test in an upcoming commit.
Configuration menu - View commit details
-
Copy full SHA for 8aafef1 - Browse repository at this point
Copy the full SHA 8aafef1View commit details -
Configuration menu - View commit details
-
Copy full SHA for afd013b - Browse repository at this point
Copy the full SHA afd013bView commit details