Magento's uiClass/uiElement objects have a feature that allow them, at the time of instantiation, to populate a property of their own (imports) from a uiRegistry registered object, or populate a property from another object (exports) from a third uiRegistry object.

What's not clear from the implementation is

  • Are there imports/exports sensitive the the order components are loaded? (i.e. naive implementation)
  • Or will the property "linking" functionality retry until it finds a registered object in the uiRegistry
  • Or is the "link" lazy loaded?
  • Does this behavior change if the uiClass/uiElement objects are used stand-alone vs. being used in a Magento_Ui/js/core/app application

I'd assume a naive implementation -- but there's a lot of javascript promise use and deferred callback loading going on in Magento_Ui/js/core/app that's not easy to follow. That, plus poor documentation of how the object system works or its intent makes this difficult to know for sure without fully unspooling a Magento_Ui/js/core/app app.

I'm hoping someone already has the answer and can spare me that code dive.


This functionality is implemented in the "links" module. When this module fetches items from the registry

#File: vendor/magento/module-ui/view/base/web/js/lib/core/element/links.js
registry.get(data.target, function (target) {

    setLink.apply(null, args);

it uses the get(index, callback) syntax. This syntax ensure the callback will not be called (and therefore the values not set) until an item exists in the registry.

This functionality is independent of the Magento_Ui/js/core/app application. Its reliant on the callback querying features of the uiRegistry module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.