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

Default values in navigation blueprints don't save #9423

Open
robdekort opened this issue Jan 31, 2024 · 2 comments
Open

Default values in navigation blueprints don't save #9423

robdekort opened this issue Jan 31, 2024 · 2 comments

Comments

@robdekort
Copy link
Contributor

robdekort commented Jan 31, 2024

Bug description

When you edit your navigation blueprint and set default values for certain fields, they don't save. So this example:
Screenshot 2024-01-31 at 09 53 16

Will save like this:

  -
    id: ab914f41-c4d2-4ecc-9f76-5a324347a6a1
    title: Hey

It should be:

  -
    id: ab914f41-c4d2-4ecc-9f76-5a324347a6a1
    title: Hey
    data:
      select: jack
      down_under: yeah_nah
      addon_devs: sleight
      toggle: true

There might be more fields (or simply all) where this happens with, but these are the one I've noticed this behaviour for over time. This behaviour is unwanted when you expect data to be there. A workaround is not to set a default and make the field required.

How to reproduce

Thy this navigation blueprint and add an entry and save it (without touching the fields):

tabs:
  main:
    display: Main
    sections:
      -
        display: General
        fields:
          -
            handle: select
            field:
              options:
                jack: Jack
                jason: Jason
                jesse: Jesse
                joshua: Joshua
                duncan: Duncan
              taggable: false
              push_tags: false
              multiple: false
              clearable: false
              searchable: true
              cast_booleans: false
              default: jack
              type: select
              display: Select
              listable: hidden
              instructions_position: above
              visibility: visible
              replicator_preview: true
              hide_display: false
          -
            handle: down_under
            field:
              options:
                yeah_nah: 'Yeah nah'
                nah_yeah: 'Nah yeah'
              default: yeah_nah
              type: button_group
              display: 'Down under'
              listable: hidden
              instructions_position: above
              visibility: visible
              replicator_preview: true
              hide_display: false
          -
            handle: addon_devs
            field:
              options:
                sleight: Sleight
                mitchell: Mitchell
              inline: false
              cast_booleans: false
              default: sleight
              type: radio
              display: 'Addon devs'
              listable: hidden
              instructions_position: above
              visibility: visible
              replicator_preview: true
              hide_display: false
          -
            handle: toggle
            field:
              inline_label: 'Save me!'
              default: true
              type: toggle
              display: Toggle
              listable: hidden
              instructions_position: above
              visibility: visible
              replicator_preview: true
              hide_display: false

Logs

No response

Environment

Application Name: Statamic Peak Development
Laravel Version: 10.42.0
PHP Version: 8.3.0
Composer Version: 2.5.5
Environment: local
Debug Mode: ENABLED
URL: statamic-peak.test
Maintenance Mode: OFF

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

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

Statamic
Addons: 4
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.46.0 PRO

Statamic Addons
studio1902/statamic-peak-browser-appearance: 3.3.4
studio1902/statamic-peak-commands: 5.0.0
studio1902/statamic-peak-seo: 8.0.0
studio1902/statamic-peak-tools: 4.4.0

Installation

Starter Kit using via CLI

Antlers Parser

None

Additional details

No response

@duncanmcclean
Copy link
Member

The fact the default values aren't being saved to the YAML file here won't be such a big deal in Statamic 5 since they'll automatically pull through in templates (or anywhere else augmentation happens) if no value is set. See #9010.

@jasonvarga
Copy link
Member

True but it's still weird that they don't get saved. They should.

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

3 participants