-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Framework: add schema for sharing/publicize #3357
Conversation
@@ -57,7 +65,7 @@ export function connections( state = {}, action ) { | |||
case SERIALIZE: | |||
return state; | |||
case DESERIALIZE: | |||
return state; | |||
return isValidStateWithSchema( state, connectionsSchema ) ? state : {}; |
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.
I'm assuming line length is what drove you to using ternary in this case and condition blocks in the others, though from a legibility perspective, I think we should be consistent (on the block?).
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.
👍 We can stick with blocks. Long ternaries tend to be more error prone.
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.
Updated in ba8b593
ca8cd3b
to
ba8b593
Compare
ba8b593
to
446518b
Compare
Perhaps |
Interesting, I'll play around with that. I would like to avoid a larger schema object if possible. |
Ah yeah, I knew there was something about this subtree I meant to bring in line with our recommendations. We should definitely make this change. @gwwar : Do you think it should be made separately? |
7e699af
to
19f173d
Compare
6b04f85
to
dfcd237
Compare
external_display: { type: 'string' }, | ||
external_profile_picture: { type: 'string' }, | ||
external_profile_URL: { type: 'string' }, | ||
external_follower_count: { type: 'integer' }, |
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.
Thanks @aduth I'll take another look |
dfcd237
to
cd6cbe8
Compare
@aduth I've updated the schema to allow null types for all external properties. |
Looks good 👍 (Side-note: I'm really excited for state persistence to gain more adoption / become enabled in production 😄 ) |
Thanks for the review! 😄 Devs should be a bit more aware of it when #3853 enables it in stage. I'll continue to chip away at these schema PRs in my spare time. |
cd6cbe8
to
f725bd4
Compare
Framework: add schema for sharing/publicize
This PR adds a schema for sharing/publicize so we can avoid data shape changes as described in #3101.
Thanks @aduth's refactors in #3417, we only need to persist connections. Other transient data like fetchingConnections will never be persisted.
Testing Instructions
calypso:state
To Validate that we can't get into an inconsistent state:
connectionsSchema
, likefoo
:cc @aduth @mtias @rralian @blowery