Problem/Motivation

An exception is thrown when you save a block config entity if you have not visited the workspace config page and pressed save.

Steps to reproduce

  1. Install standard
  2. Enable wse_config and workspaces_ui
  3. Activate the stage workspace
  4. Go to admin/structure/block/manage/olivero_site_branding - press save
The website encountered an unexpected error. Try again later.

RuntimeException: The "block" entity type can only be saved in the default workspace. in Drupal\workspaces\EntityOperations->entityPresave() (line 133 of core/modules/workspaces/src/EntityOperations.php).
Drupal\workspaces\Hook\WorkspacesHooks->entityPresave(Object, 'block')
call_user_func_array(Array, Array) (Line: 355)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Array, 'workspaces') (Line: 307)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_presave', Object) (Line: 354)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array) (Line: 325)
Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('presave', Object) (Line: 529)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 483)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 239)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 617)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 293)
Drupal\Core\Entity\EntityForm->save(Array, Object) (Line: 350)
Drupal\block\BlockForm->save(Array, Object)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork wse-3494268

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alexpott created an issue. See original summary.

alexpott’s picture

This happens for any config entity type that you edit why a workspace is active. I think we need to prevent access or something neater than thrown an exception.

alexpott’s picture

Relatedly and conversely whe you edit simple configuration that's not supported - for example workspaces.settings on admin/config/workflow/workspaces/settings when you are in a workspace it'll save and make immediate changes to the live config, which feels at best quite inconsistent.

amateescu’s picture

Version: 2.0.x-dev » 3.0.x-dev

There are 3 things discussed in this issue:

1. entity forms throw exceptions on submit for unsupported entity types: this should be fixed in a core issue

2. wse_config doesn't handle enabling support for config entity types without submitting the configuration form: easy to fix in wse_config

3. support for simple config is very much lacking (per #3): opened #3563938: Refactor the way we enable/support simple config and config entities to tackle that

amateescu’s picture

Status: Active » Needs review

Opened a MR for the second point mentioned above.

  • amateescu committed 4874e367 on 3.0.x
    fix: #3494268 Exception thrown from WSE Config
    
    By: alexpott
    By:...

  • amateescu committed c587e47c on 2.0.x
    fix: #3494268 Exception thrown from WSE Config
    
    By: alexpott
    By:...

  • amateescu committed 01087866 on 1.0.x
    fix: #3494268 Exception thrown from WSE Config
    
    By: alexpott
    By:...
amateescu’s picture

Status: Needs review » Fixed

And merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.