-
Notifications
You must be signed in to change notification settings - Fork 4.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
Migrate resolvers to thunks: getAuthors,_getCurrentUser,__getCurrentTheme,__getThemeSupports #34579
Conversation
Size Change: +7 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
db7912a
to
cc07d3a
Compare
This diff now migrates |
2b549e9
to
c36ffe9
Compare
c36ffe9
to
e13df87
Compare
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.
👍
yield receiveThemeSupports( activeThemes[ 0 ].theme_supports ); | ||
} | ||
dispatch.receiveThemeSupports( activeThemes[ 0 ].theme_supports ); | ||
}; |
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.
getCurrentTheme
and getThemeSupports
will issue a duplicate REST request, instead of sharing an existing cached response. The getThemeSupports
resolver could be written as:
const getThemeSupports = () => async ( { resolveSelect } ) => {
const currentTheme = await resolveSelect.getCurrentTheme();
dispatch.receiveThemeSupports( currentTheme.theme_supports );
};
The next step would be to ditch receiveThemeSupports
and the associated state, and implement the getThemeSupports
selector in terms of getCurrentTheme
.
Can be a separate PR, doesn't prevent merging this one as-is at all.
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.
Good point! I think it issues a duplicate REST request already and that would be a good quality of life improvement 👍
Builds on top of the thunks support added in #27276 and refactors just the parts of core-data required to make the
getEntityRecord
work (this PR is a minimal viable subset of #28389 with unit tests adjusted).Test plan:
Confirm the automated tests pass
blog title
block, edit it, save the post and related entities