Metadata
- Source
- FLUID-5611
- Type
- Improvement
- Priority
- Major
- Status
- Closed
- Resolution
- Won't Fix
- Assignee
- Antranig Basman
- Reporter
- Antranig Basman
- Created
2015-03-31T14:00:33.921-0400 - Updated
2024-07-22T10:35:25.284-0400 - Versions
- N/A
- Fixed Versions
- N/A
- Component
-
- Framework
Description
This was observed in debugging a problem with the SeparatedPanelPrefsEditor - in a branch for FLUID-5597, the following reference had been added to the grade definition:
fluid.defaults("fluid.prefs.separatedPanel", {
gradeNames: ["fluid.prefs.prefsEditorLoader", "autoInit"],
....
messageBase: "{messageLoader}.resources.prefsEditor", // ERROR here
This attempted to reference a resource which should only be available asynchronously - one of the bundles loaded by the messageLoader. The relevant configuration for prefsEditorLoader is:
fluid.defaults("fluid.prefs.prefsEditorLoader", {
gradeNames: ["fluid.viewRelayComponent", "autoInit"],
messageLoader: {
type: "fluid.prefs.resourceLoader",
options: {
resourceOptions: {
dataType: "json"
},
events: {
onResourcesLoaded: "{prefsEditorLoader}.events.onPrefsEditorMessagesLoaded"
}
}
}
events: {
onPrefsEditorTemplatesLoaded: null,
onPrefsEditorMessagesLoaded: null,
onCreatePrefsEditorReady: {
events: {
templateLoaded: "onPrefsEditorTemplatesLoaded",
messagesLoaded: "onPrefsEditorMessagesLoaded"
}
}
},
What was observed was that the "onResourcesLoaded" event fired, but the onPrefsEditorMessagesLoaded event which in theory was identical with it did not fire. The reason was that this firing was triggered synchronously as a result of resources which loaded from the cache, before the options merging process for separatedPanel had completed and any of the listeners attached to this event could be evaluated.
The original reference was impossible, but the framework should give more comprehensible behaviour in this case. In particular, any event which is triggered for a component during its own options evaluation process must certainly be considered an error, and the framework should halt at that point.
If we do decide to support this behaviour, another possibility would be to schedule events/listener merging earlier in the process than general options evaluation, but this still seems very likely to leave cases of unexpected and indeterminate behaviour.
Comments
-
Antranig Basman commented
2019-08-01T09:29:00.177-0400 In the new, post FLUID-6148 framework such a condition is not an error and indeed highly likely. Also, the various issues referred to in the report relating to asynchronously loaded resources are resolved by the new ResourceLoader architecture