Skip to content

Theme issue on setup:upgrade #35843

Open
Open
@Nuranto

Description

Summary (*)

When performing a setup:upgrade, we get :

The following themes will be registered: adminhtml/Magento/blank, adminhtml/Hyva/reset, adminhtml/Magento/luma, adminhtml/Hyva/default
The following themes will be removed: frontend/Magento/blank, frontend/Magento/luma, frontend/Hyva/reset, frontend/Hyva/default

The issue is here :
app/code/Magento/Theme/Model/Theme.php

public function getArea()
    {
        // In order to support environment emulation of area, if area is set, return it
        if ($this->getData('area') && !$this->_appState->isAreaCodeEmulated()) {
            return $this->getData('area');
        }
        return $this->_appState->getAreaCode();
    }

The emulation of adminhtml is triggered in setup:upgrade by /var/www/html/vendor/magento/module-deploy/Console/Command/App/ConfigImportCommand.php(106)

Proposed solution

I can't see any usecase where a theme should return the current state area, so the better solution seems to be :

public function getArea()
    {
            return $this->getData('area');
    }

(or simply remove the whole function, and let the magic functions deal with it.)
Also, the appState should be removed from constructor.

Or if some reason I can't see, sometimes the area is not defined (imho this should not be permitted), we could keep the fallback like this :

public function getArea()
    {
          return $this->getData('area') ?: $this->_appState->getAreaCode();
    }

But it seems to me that this is a bad solution.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users with no workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Assignees

Labels

Issue: needs updateAdditional information is require, waiting for responseTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions