Repository navigation
Migrate resolvers to thunks: getAuthors,_getCurrentUser,__getCurrentTheme,__getThemeSupports - #34579
Merged
Merged
Conversation
|
Size Change: +7 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
adamziel
force-pushed
the
update/resolvers-migration-next-step
branch
from
September 6, 2021 14:28
db7912a to
cc07d3a
Compare
Member
|
This diff now migrates |
adamziel
force-pushed
the
update/resolvers-migration-next-step
branch
from
September 7, 2021 10:59
2b549e9 to
c36ffe9
Compare
adamziel
force-pushed
the
update/resolvers-migration-next-step
branch
from
September 7, 2021 11:51
c36ffe9 to
e13df87
Compare
jsnajdr
approved these changes
Sep 7, 2021
| yield receiveThemeSupports( activeThemes[ 0 ].theme_supports ); | ||
| } | ||
| dispatch.receiveThemeSupports( activeThemes[ 0 ].theme_supports ); | ||
| }; |
Member
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
Good point! I think it issues a duplicate REST request already and that would be a good quality of life improvement 👍
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Builds on top of the thunks support added in #27276 and refactors just the parts of core-data required to make the
getEntityRecordwork (this PR is a minimal viable subset of #28389 with unit tests adjusted).Test plan:
Confirm the automated tests pass
blog titleblock, edit it, save the post and related entities