Skip to content

Global set variables duplicated #435

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

Closed
CapitaineToinon opened this issue May 30, 2025 · 3 comments
Closed

Global set variables duplicated #435

CapitaineToinon opened this issue May 30, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@CapitaineToinon
Copy link

Bug description

When storing global sets in the file system but global set variables in the database, it seems that saving a global set through the cp saves correctly the data to the database but also saves duplicated data in the flat files.

That data isn't actually the source of truth as modifying the yaml file directly and reloading the cp doesn't change the data, proving it's correctly being loaded from the database. However it would be nice if it still wasn't happening has I'd like to keep the yaml files in version control for consistency and use the git features, but editing the global through cp will trigger a git push and a deployment, which is the whole thing I was trying to avoid by having the global set variables in the database.

How to reproduce

Install the eloquent driver and set the globals as such:

'global_sets' => [
    'driver' => 'file',
    'model' => \Statamic\Eloquent\Globals\GlobalSetModel::class,
],
                                                                 
'global_set_variables' => [
    'driver' => 'eloquent',
    'model' => \Statamic\Eloquent\Globals\VariablesModel::class,
],

Create a global, such as footer:

Image

Add a field:

Image

This correctly creates content/globals/footer.yaml:

title: Footer

And resources/blueprints/globals/footer.yaml

tabs:
  main:
    display: Main
    sections:
      -
        fields:
          -
            handle: copyright
            field:
              type: markdown
              display: 'Markdown Field'

Now, modifying the content of the footer will correctly update the entry in the database:

Image

But this will also update content/globals/footer.yaml:

title: Footer
data:
  copyright: 'Hello, world'

Logs

Environment

Environment
Application Name: Statamic
Laravel Version: 12.15.0
PHP Version: 8.4.7
Composer Version: 2.8.8
Environment: local
Debug Mode: ENABLED
URL: localhost
Maintenance Mode: OFF
Timezone: UTC
Locale: en

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

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

Storage
public/storage: NOT LINKED

Livewire
Livewire: v3.6.3

Statamic
Addons: 2
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.56.0 PRO

Statamic Addons
statamic/eloquent-driver: 4.23.0
statamic/ssg: 3.1.1

Statamic Eloquent Driver
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: file
Entries: eloquent
Forms: file
Global Sets: file
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: file
Revisions: eloquent
Sites: file
Taxonomies: file
Terms: file
Tokens: eloquent

Additional details

No response

@CapitaineToinon CapitaineToinon added the bug Something isn't working label May 30, 2025
@CapitaineToinon
Copy link
Author

I see there are currently two PR opened about globals, #431 and #411. Could it be related?

@ryanmitchell
Copy link
Contributor

Duplicate of #428
See comment there.

@CapitaineToinon
Copy link
Author

Oh awesome, thanks! Sorry about the duplicate.

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

2 participants