Skip to content

Commit

Permalink
Avoid LivePreviewButton appearing a moment later
Browse files Browse the repository at this point in the history
  • Loading branch information
okmttdhr committed Aug 2, 2023
1 parent 8dad318 commit 058c7fe
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion client/my-sites/theme/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,8 @@ class ThemeSheet extends Component {
isLoggedIn,
themeId,
siteId,
isWpcomTheme,
isWporg,
} = this.props;
const placeholder = <span className="theme__sheet-placeholder">loading.....</span>;
const title = name || placeholder;
Expand Down Expand Up @@ -643,7 +645,14 @@ class ThemeSheet extends Component {
( this.shouldRenderUnlockStyleButton()
? this.renderUnlockStyleButton()
: this.renderButton() ) }
<LivePreviewButton themeId={ themeId } siteId={ siteId } />
<LivePreviewButton
themeId={ themeId }
/**
* Pass the siteId that QueryCanonicalTheme component will use to fetch the theme.
* This avoids LivePreviewButton appearing a moment later.
*/
siteId={ ( isWpcomTheme && 'wpcom' ) || ( isWporg && 'wporg' ) || siteId }
/>
{ this.shouldRenderPreviewButton() && (
<Button
onClick={ ( e ) => {
Expand Down

0 comments on commit 058c7fe

Please sign in to comment.