Live Preview: Show the current theme name on the theme activation modal#57588
Merged
arthur791004 merged 4 commits intoWordPress:trunkfrom Jan 12, 2024
Conversation
22e7337 to
142d29d
Compare
| } ); | ||
|
|
||
| apiFetch( { path } ).then( ( activeThemes ) => | ||
| setCurrentTheme( activeThemes[ 0 ] ) |
Contributor
There was a problem hiding this comment.
Does it make sense to handle a request error here? Wondering if it's safe to access activeThemes[ 0 ] here.
Contributor
Author
fushar
reviewed
Jan 11, 2024
| themeName | ||
| /* translators: %1$s: The name of active theme, %2$s: The name of theme to be activated. */ | ||
| __( | ||
| 'Saving your changes will change your active theme from %1$s to %2$s' |
Contributor
There was a problem hiding this comment.
We're missing the last period (.) here; it was there before this PR.
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.

What?
Display the name of the currently active theme on the theme activation modal
Why?
Resolved Automattic/wp-calypso#81878
How?
Use the
apiFetchwithwp_theme_preview=to bypass thecreateThemePreviewMiddlewareand get the currently active theme.Another way is to create a new resolver, selector, and reducer to get the raw current theme and save it into the redux store. But I think it's only used by this modal now so we don't need to introduce new variable into the redux store.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast