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

Duplicating sets duplicates ALL values (also the values of hidden fields) #11310

Open
axelferdinand opened this issue Jan 3, 2025 · 0 comments

Comments

@axelferdinand
Copy link

Bug description

This is a little hard to explain, but I'll do my best:

I use a lot of conditional fields, and discovered that duplicating sets duplicates ALL values, and stores them, despite changes done in the new, duplicated set has fields that has the following setting disabled:

"Always save field value, even if field is hidden."

With the new duplicated sets, you simply cannot remove stored values stuck from the original – you will have to edit the markdown files to remove some of the values.

How to reproduce

Include the following fieldset in a Bard set, and then:

  1. create a module with some custom settings involving the Promo settings
  2. duplicate the set
  3. set default settings on the new set

Now contains values from the set you duplicated, despite ""Always save field value, even if field is hidden." is not enabled.

title: Promo
fields:
  -
    handle: promo_content
    field:
      type: section
      display: 'Promo Content'
  -
    handle: promo_image
    field:
      max_files: 1
      mode: grid
      container: main
      folder: img
      type: assets
      display: Image
      validate:
        - required
  -
    handle: promo_tagline
    field:
      type: text
      display: Tagline
  -
    handle: promo_title
    field:
      type: text
      display: Title
      validate:
        - required
      character_limit: 72
  -
    import: bard_summary
    prefix: promo_
  -
    import: buttons
  -
    handle: promo_settings
    field:
      type: section
      display: 'Promo Settings'
  -
    handle: promo_type
    field:
      options:
        -
          key: default
          value: Default
        -
          key: fullwidth
          value: Fullwidth
        -
          key: offset
          value: Offset
        -
          key: box
          value: Box
        -
          key: overlay
          value: Overlay
      default: default
      type: button_group
      display: Type
  -
    handle: promo_overlay_position
    field:
      options:
        -
          key: top-right
          value: 'Top Right'
        -
          key: bottom-right
          value: 'Bottom Right'
        -
          key: bottom-left
          value: 'Bottom Left'
        -
          key: top-left
          value: 'Top Left'
      default: top_right
      type: button_group
      display: 'Overlay Box Position'
      if:
        promo_type: 'equals overlay'
      always_save: false
  -
    handle: promo_image_position
    field:
      options:
        -
          key: left
          value: Left
        -
          key: right
          value: Right
      default: left
      type: button_group
      display: 'Image Position'
      width: 50
      unless:
        promo_type: 'equals overlay'
  -
    handle: promo_image_format
    field:
      options:
        -
          key: square
          value: 'Square (1:1)'
        -
          key: portrait
          value: 'Portrait (3:4)'
      default: square
      type: button_group
      display: 'Image Format'
      width: 50
      if_any:
        promo_type: 'equals default'
  -
    handle: promo_align
    field:
      options:
        -
          key: top
          value: Top
        -
          key: center
          value: Center
        -
          key: bottom
          value: Bottom
      default: center
      type: button_group
      display: 'Vertical Text Align'
      unless_any:
        promo_type: 'contains_any overlay, box'

Logs

No response

Environment

Environment
Application Name: Virke
Laravel Version: 11.37.0
PHP Version: 8.3.13
Composer Version: 2.5.5
Environment: development
Debug Mode: ENABLED
URL: virke.proto
Maintenance Mode: OFF
Timezone: UTC
Locale: no

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: sendmail
Queue: sync
Session: file

Statamic
Addons: 2
Sites: 1
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.45.0 PRO

Statamic Addons
aryehraber/statamic-captcha: 1.14.0
pecotamic/sitemap: 1.4.7

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants