craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 626 forks source link

Disabling auto-refresh on more than 1 section will not retain necessary changes to all sections in project config files #10160

Open joepagan opened 2 years ago

joepagan commented 2 years ago

Description

Disabling auto-refresh on more than 1 section will not retain necessary changes to all sections in project config files

state of config/project/sections/photography--cad713ff-8485-4ab5-b6e8-df193c2e5937.yaml after disabling auto-refresh on this particular section (what I wanted):

defaultPlacement: end
enableVersioning: true
handle: photography
name: Photography
previewTargets:
  -
    __assoc__:
      -
        - label
        - 'Primary entry page'
      -
        - urlFormat
        - '{url}'
      -
        - refresh
        - ''
propagationMethod: all
siteSettings:
  62b01cf3-0997-446f-b44e-a4ceede4f311: # $SYSTEM_NAME
    enabledByDefault: true
    hasUrls: true
    template: services/_builder
    uriFormat: '{% if parent %}{parent.slug}/{% endif %}{slug}'
structure:
  maxLevels: 3
  uid: f864fced-109a-4c6d-8111-ad5e4a5c390b
type: structure

Same file after disabling auto-refresh in another section:

enableVersioning: true
handle: photography
name: Photography
previewTargets:
  -
    __assoc__:
      -
        - label
        - 'Primary entry page'
      -
        - urlFormat
        - '{url}'
propagationMethod: all
siteSettings:
  62b01cf3-0997-446f-b44e-a4ceede4f311: # $SYSTEM_NAME
    enabledByDefault: true
    hasUrls: true
    template: services/_builder
    uriFormat: '{% if parent %}{parent.slug}/{% endif %}{slug}'
structure:
  maxLevels: 3
  uid: f864fced-109a-4c6d-8111-ad5e4a5c390b
type: structure

Steps to reproduce

  1. 2 sections have auto-refresh enabled
  2. disable auto-refresh on section 1, suitable project config file changes occur
  3. disable auto-refresh on a section 2, project config files reset section 1 (re-enabling auto-refresh for section 1 in project config files) so only section 2 now has auto-refresh disabled in the project config files
  4. database retains changes (until project config is re-applied)

Additional info

andris-sevcenko commented 2 years ago

First step is definitely updating to the latest Craft version and seeing if the issue persists.

joepagan commented 2 years ago

Unfortunately don't have time available to action that on this project to test all the features and release, couldn't see any existing issues or references in the change log so thought I'd log it.

andris-sevcenko commented 2 years ago

@joepagan understandable.

Is this happening on the same environment? As in, you make the changes, see the project.yaml file change, make the changes, see it revert back?

Can you try clearing all your caches?

joepagan commented 2 years ago

Is this happening on the same environment? As in, you make the changes, see the project.yaml file change, make the changes, see it revert back?

That is correct, I was trying to action this on a dev environment to push the config changes to production.

Can you try clearing all your caches?

Just reverted it back, cleared the caches and tried again and can confirm the project config files are as they should be!

andris-sevcenko commented 2 years ago

Ah, okay. So everything is good now?

joepagan commented 2 years ago

Yes that appears to be working as intended now, though is there still a bug?

Surely we are not expected to clear the cache before applying backend changes for the project config files to be accurate?

andris-sevcenko commented 2 years ago

FWIW, we've seen this happen maybe two times before and in both cases it wasn't possible to pinpoint why or how this was happening, only that a certain cache got stuck.

Are you using Docker in this environment?

joepagan commented 2 years ago

I am indeed using docker just on dev on this project. Though I do work with docker for uat/prod envs on other projects also.

It does sound like a cache isn't being invalidated on section save, the database was reporting the section setting correctly of course.