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

Duotone: Caching breaks duotones set through theme.json #36208

Closed
scruffian opened this issue Nov 4, 2021 · 1 comment · Fixed by #36236
Closed

Duotone: Caching breaks duotones set through theme.json #36208

scruffian opened this issue Nov 4, 2021 · 1 comment · Fixed by #36236
Assignees
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@scruffian
Copy link
Contributor

Description

When a duotone filter is set through theme.json, the SVGs are output to the footer using a side effect of gutenberg_render_duotone_filter_preset. This happens the first time that Global Styles are generated. However, once this has happened the output value is cached. Once the cache is primed, Global Styles aren't generated in the code anymore, which means the side effect of gutenberg_render_duotone_filter_preset doesn't happen and the SVGs aren't output. This means that all images with a duotone applied via theme.json disappear.

Step-by-step reproduction instructions

  1. Ensure that your environment doesn't have any of these consts set:
  2. Apply a duotone filter to a theme via the theme.json file:
			"core/image": {
				"filter": {
					"duotone": "var(--wp--preset--duotone--default-filter)"
				}
			}
	"settings": {
		"color": {
			"duotone": [
                {
                    "colors": [ "#000", "#B9FB9C" ],
                    "slug": "default-filter",
                    "name": "Default filter"
                }
  1. On the first load this works fine, on subsequent loads the images break

Screenshots, screen recording, code snippet

No response

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

@scruffian scruffian added the [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi label Nov 4, 2021
@ajlende ajlende added the [Type] Bug An existing feature does not function as intended label Nov 4, 2021
@ajlende
Copy link
Contributor

ajlende commented Nov 4, 2021

Interestingly, when I set $can_use_cached = true, sometimes none of the theme.json styles load. These screenshots are using the skatepark theme.

Screen Shot 2021-11-04 at 11 38 49

Screen Shot 2021-11-04 at 11 39 07

EDIT: It seems to happen when I switch from false to true for a minute or so. It looks like the the set_transient call that happens assumes that there is something in the cache already even when it isn't. This can probably be disregarded.

@ajlende ajlende mentioned this issue Nov 5, 2021
7 tasks
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [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