Problem/Motivation

If I have a new node type with Canvas Override enabled:

dependencies:
  module:
    - canvas_override
    - menu_ui
third_party_settings:
  menu_ui:
    available_menus:
      - main
    parent: 'main:'
  canvas_override:
    enabled: true

Then I run drush cim on this type, it fails:

    The import failed due to the following reasons:                                                                                                                                          
    Unexpected error during import with operation create for node.type.MY_CONTENT_TYPE: Missing bundle entity, entity type node_type, entity id MY_CONTENT_TYPE.                                 
    Unexpected error during import with operation create for field.field.node.MY_CONTENT_TYPE.field_canvas_layout: Missing bundle entity, entity type node_type, entity id MY_CONTENT_TYPE.

This is because CanvasOverride::nodeTypePresave() fires unconditionally and tries to create the Canvas field on the content type before the content type exists.

Steps to reproduce

  1. Create a new content type
  2. Enable Canvas Override
  3. ddev drush cex -y
  4. Delete the content type
  5. ddev drush cim -y

Proposed resolution

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ✅ Automated unit testing coverage
  • ✅ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ➖ Readability
  • ➖ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Developer Documentation
  • ➖ User Guide Documentation
  • ➖ Reviewed by human
  • ➖ Code review by maintainers
  • ➖ Full testing and approval
  • ✅ Credit contributors
  • ➖ Review with the product owner
  • ➖ Release notes snippet
  • ✅ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
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

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review

Proposed fix that works for me; move the presave hook to insert/update hooks, and explicitly skip when we are syncing config (we assume that the config import is correct and dependencies will be handled for us).

rajab natshah made their first commit to this issue’s fork.

  • rajab natshah committed 4de6ccb9 on 1.0.x
    test: #3616302 Add regression test coverage for the config import fix
    
rajab natshah’s picture

Assigned: Unassigned » josebc
Issue tags: +canvas_override-1.0.0-beta3
rajab natshah’s picture

Assigned: josebc » mohammed j. razem
rajab natshah’s picture

Assigned: mohammed j. razem » Unassigned
Issue summary: View changes
Status: Needs review » Fixed

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.

rajab natshah’s picture

Issue summary: View changes