onboarding updates #56

Merged
neb-b merged 2 commits from onboarding into master 2019-09-17 16:33:15 +02:00
neb-b commented 2019-09-09 05:24:52 +02:00 (Migrated from github.com)
No description provided.
akinwale (Migrated from github.com) reviewed 2019-09-09 05:24:52 +02:00
kauffj (Migrated from github.com) reviewed 2019-09-13 23:16:51 +02:00
@ -0,0 +15,4 @@
export function userStateSyncMiddleware() {
return ({ getState }) => next => action => {
if (
action.type === ACTIONS.CHANNEL_SUBSCRIBE ||
kauffj (Migrated from github.com) commented 2019-09-13 23:12:03 +02:00

you can write this as [ACTIONS.CHANNEL_SUBSCRIBE, ACTIONS.CHANNEL_UNSUBSCRIBE, LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW].includes(action.type)

same for a similar check above

(it's not required or even strongly suggested to do the above, just sharing)

you can write this as `[ACTIONS.CHANNEL_SUBSCRIBE, ACTIONS.CHANNEL_UNSUBSCRIBE, LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW].includes(action.type)` same for a similar check above (it's not required or even strongly suggested to do the above, just sharing)
@ -0,0 +36,4 @@
let newSubscriptions = subscriptions.slice();
newSubscriptions = newSubscriptions.filter(subscribedUri => subscribedUri !== uri);
newShape.shared.subscriptions = newSubscriptions;
} else {
kauffj (Migrated from github.com) commented 2019-09-13 23:15:00 +02:00

I would keep this check explicit. You could also consider making this a switch.

Also, is there any way to have this fire after any reducers fire, so that you do not have to repeat the logic for each action that modifies the state?

I understand why you do not want a separate reducer for tracking shared state, but if you can have this function fire after reducers update redux state, then this logic becomes a lot simpler now and moving forward. All this function would need to do is re-select all user state and compare this state to the last previous known state.

I would keep this check explicit. You could also consider making this a `switch`. Also, is there any way to have this fire after any reducers fire, so that you do not have to repeat the logic for each action that modifies the state? I understand why you do not want a separate reducer for tracking shared state, but if you can have this function fire after reducers update redux state, then this logic becomes a lot simpler now and moving forward. All this function would need to do is re-select all user state and compare this state to the last previous known state.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbryinc#56
No description provided.