FLUID-6146: Two "createOnEvent" components which are triggered by the same event cannot mutually refer

Metadata

Source
FLUID-6146
Type
Bug
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Antranig Basman
Created
2017-03-11T22:37:35.116-0500
Updated
2024-07-22T10:35:28.598-0400
Versions
  1. 2.0
Fixed Versions
  1. 4.0
Component
  1. IoC System

Description

Currently there is no sense of "transactionality" in the IoC instantiation process beyond that of being rooted in a single component. As a result, two components which are registered as "createOnEvent" for the same event cannot make reference to each other via IoC references, after the fix to FLUID-5266.

For example, the following setup will fail:

fluid.defaults("examples.creator", {
    gradeNames: "fluid.component",
    events: {
        createIt: null
    },
    components: {
        dynamicOne: {
            createOnEvent: "createIt",
            type: "fluid.component",
            options: {
                value: 3
            }
        },
        dynamicTwo: {
            createOnEvent: "createIt",
            type: "fluid.component",
            options: {
                value: "{creator}.dynamicOne.options.value"
            }
        }
    }
});

The firing of the event "createIt" in this case will trigger the FLUID-5266 diagnostic for referring to a "createOnEvent" component before its construction time (in this case, 50% of the time, although the rate could be increased to 100% by creating a cyclic reference). The framework should be able to treat the construction of all components triggered by the same component as a single transactional unit.

This issue was informally reported by @@Colin Clark some time ago during some implementation work for the Flocking audio synthesis engine.