Skip to content
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

Theme preview activation does not work after navigating in the previewing site editor #61239

Closed
draganescu opened this issue Apr 30, 2024 · 4 comments · Fixed by #61394
Closed
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@draganescu
Copy link
Contributor

Description

Live preview should allow users to customise a theme before activation. This feature is lost now as any navigation in the site editor that previews a theme removes the save button.

Step-by-step reproduction instructions

  1. Go to Appearance > Themes
  2. On any of the installed and inactive block themes hover and click "Live preview"
  3. On the Site editor that opens, click on any of the sidebar items
  4. Notice bug: the activate button disappears replaced w/ a "Saved" disabled button

Screenshots, screen recording, code snippet

broken-preview-edits.mp4

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@draganescu draganescu added [Type] Bug An existing feature does not function as intended [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Apr 30, 2024
@ntsekouras
Copy link
Contributor

I'm wondering if the changes in router could have caused this because the utils isPreviewingTheme and currentlyPreviewingTheme check the URL. Or maybe this PR. I'll take a look..

@ntsekouras
Copy link
Contributor

It seems the changes in router that we strip the checked query params, are responsible for this. I'm not sure though if we should add complexity in router to preserve some specific params and others not. Could we preserve the info whether is previewing a theme (and what else is needed) in the store? 🤔 --cc @scruffian @jsnajdr

@draganescu
Copy link
Contributor Author

Indeed I confirmed by reading #60466 and also resetting to before it.

@jsnajdr the way the sidebar now works with history discards any query string. Was that on purpose? The old goTo etc kept the query string around.

Also I think those query strings related to theme preview are a back compat issue.

@jsnajdr
Copy link
Member

jsnajdr commented May 6, 2024

the way the sidebar now works with history discards any query string. Was that on purpose?

Yes and no. I removed the behavior where query params are preserved during navigation, because that's not compatible with "mainstream" routing. URLs don't work like this. Going from /foo?a=1 to /foo?b=2 removes the a param. The destination is not /foo?a=1&b=2.

But I missed that it's breaking some features. We'll need to fix that. There is wp_theme_preview, and also activeView is not preserved when working with data views.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants