-
-
Notifications
You must be signed in to change notification settings - Fork 673
redux: Distinguish per-account vs global state (1/n) #5017
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1790f10
redux types: Introduce PerAccountState, for now just an alias
gnprice 3cea46b
redux types: Split GlobalSelector vs. Selector
gnprice 4c0b7ee
redux types: Use GlobalSelector on global selectors
gnprice b33f278
redux types: Add two assumeSecretlyGlobalState markings
gnprice 59d8813
redux types: Mark most selectors as per-account vs. global
gnprice 20bca74
redux types: Split PerAccountSessionState from SessionState
gnprice 3d98cf9
redux types: Split PerAccountSettingsState from SettingsState
gnprice ab805f2
redux types: Distinguish PerAccountState from GlobalState
gnprice 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
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| /* @flow strict-local */ | ||
| import type { Fetching, GlobalState, Narrow } from '../types'; | ||
| import type { Fetching, PerAccountState, Narrow } from '../types'; | ||
| import { getFetching } from '../directSelectors'; | ||
| import { keyFromNarrow } from '../utils/narrow'; | ||
|
|
||
| /** The value implicitly represented by a missing entry in FetchingState. */ | ||
| export const DEFAULT_FETCHING = { older: false, newer: false }; | ||
|
|
||
| export const getFetchingForNarrow = (state: GlobalState, narrow: Narrow): Fetching => | ||
| export const getFetchingForNarrow = (state: PerAccountState, narrow: Narrow): Fetching => | ||
| getFetching(state)[keyFromNarrow(narrow)] || DEFAULT_FETCHING; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| /* @flow strict-local */ | ||
| import type { Narrow, GlobalState } from '../types'; | ||
| import type { Narrow, PerAccountState } from '../types'; | ||
| import { keyFromNarrow } from '../utils/narrow'; | ||
|
|
||
| export const getDraftForNarrow = (state: GlobalState, narrow: Narrow): string => | ||
| export const getDraftForNarrow = (state: PerAccountState, narrow: Narrow): string => | ||
| state.drafts[keyFromNarrow(narrow)] || ''; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Just to check my understanding: Is it intentional that
getIdentityis still aSelectorat the time this change is made, and the switch toGlobalSelectorcomes after?In the commit message, I see "[…] invokes one of those selectors (which demands a GlobalState)", and I think I'm a little confused because at this commit
getIdentitydoesn't yet demand aGlobalState, by that name, anyway.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.
Yeah, I guess that is kind of talking about the future. Probably it'd be clearer to switch things to GlobalSelector where appropriate, then add these two markings, then switch other selectors to PerAccountState where appropriate (and then make the change that distinguishes PerAccountState from GlobalState.) I'll quick make that change.