Skip to content

[Issue] Fix handling of mixins for modules with no dependencies defined #28340

Closed
@ghost

Description

This issue is automatically created based on existing pull request: #27690: Fix handling of mixins for modules with no dependencies defined


Description (*)

This PR addresses an issue that was outlined in #25587 (comment) and investigated by me afterwards.

This is a regression I have introduced when refactoring mixins module, but it applies only in two cases which are not present in the Magento itself:

// Module defined as anything else then a function with dependencies skipped.
define('my-module', {
  foo: 'bar'
});
// Module defined with dependencies passed as "null".
define('my-module', null, {
  foo: 'bar'
});

which both results in special case where second element of RequireJS's defQueue is null and made the script throw an error when somebody required such module.

Manual testing scenarios (*)

  1. Open the store.
  2. Open browser console.
  3. Paste and execute the following code:
define('my-module', {
  foo: 'bar'
});
require(['my-module', function(){});
  1. Verify that no error similar to TypeError: Cannot read property 'map' of null is thrown.

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedPriority: P3May be fixed according to the position in the backlog.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions