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

Cache not clearing after saving Commerce products #474

Closed
philipboomy opened this issue Feb 9, 2023 · 12 comments
Closed

Cache not clearing after saving Commerce products #474

philipboomy opened this issue Feb 9, 2023 · 12 comments
Labels
bug Something isn't working

Comments

@philipboomy
Copy link

I am running into products not refreshing after clicking save.

  1. Selecting some products in a "Product field" and clicking save
  2. Go to frontend and check and page is still cached.
  3. Change a text field and clicking save.
  4. Go to frontend and check and page is still cached.
  5. Edit the title field and click save.
  6. Go to frontend and check and page is now refreshed.

I waited till queue was done running just in case. Didn't change anything.

Logging is on locally but nothing in the log.

Blitz 4.3.0 and Craft CMS 4.3.8.1

@philipboomy philipboomy added the bug Something isn't working label Feb 9, 2023
@bencroker
Copy link
Collaborator

Are you saying that the product page is not cleared, or an element that is related to a product? Please provide more details so I can replicate locally.

@philipboomy
Copy link
Author

Thanks for quick repsonse.

The product I am editing is not cleared. The product field is just one type of edit I am doing on the product. Another is the text field in step 3.

@bencroker
Copy link
Collaborator

bencroker commented Feb 9, 2023

Ok, can you please rephrase it to the simplest example which is not working as expected, with steps to replicate?

@philipboomy
Copy link
Author

  1. Edit a text field on a product
  2. Save product
  3. Visit product frontend
  4. See that product is cached and the change in step 1 is not showing frontend.

@bencroker
Copy link
Collaborator

Thank you, I'll investigate that use-case today.

@bencroker
Copy link
Collaborator

I believe this is due to products not auto-saving drafts, which I've fixed in 3473b56 for the next release.

@bencroker
Copy link
Collaborator

bencroker commented Feb 9, 2023

On second look, this method looks like it's too eager – fields are always marked as dirty when saved in the CP, regardless of whether they have changed or not. I'll need to look into whether something has changed in recent Craft versions and otherwise come up with a workaround.

@Mathias-Syversen
Copy link

Mathias-Syversen commented Feb 10, 2023

I can confirm blitz does not seem to clear cache on normal entries too:

  1. Edit redactor field on entry
  2. Save entry, wait for all queue jobs to finish (did not see any clearing blitz cache jobs).
  3. Refresh frontend, changes not out.
  4. Clear cache in utilities, changes appear.

We have this problem on two separate sites now after updating Blitz to latest.

Edit: We use "Clear the cache and regenerate in a queue job" as refresh mode.

@bencroker
Copy link
Collaborator

@Mathias-Syversen did you update Craft as well as Blitz? Just trying to figure out which update might have caused this change in behaviour.

@bencroker
Copy link
Collaborator

@Mathias-Syversen I just ran a local test and modifying an entry does refresh the cache as expected. Can you please create a new issue with more details so as to not confuse the issue we're working through here with Commerce products?

@bencroker bencroker changed the title Cache not clearing after save Cache not clearing after saving Commerce products Feb 10, 2023
@bencroker
Copy link
Collaborator

bencroker commented Feb 11, 2023

It looks like elements that do not support drafts, which includes Commerce products, were not triggering cache refreshes as of version 4.3.0. I've fixed in 3473b56 and released in version 4.3.1. It would be great if you could confirm that this fixes your issue @philipboomy.

@philipboomy
Copy link
Author

@bencroker I can confirm it is fixed. Cache is clearing after saving a product.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants