Metadata
- Source
- FLUID-6126
- Type
- Bug
- Priority
- Major
- Status
- Closed
- Resolution
- Fixed
- Assignee
- Antranig Basman
- Reporter
- Antranig Basman
- Created
2017-02-08T21:22:48.623-0500 - Updated
2017-02-09T10:33:02.708-0500 - Versions
-
- 2.0
- Fixed Versions
- N/A
- Component
-
- IoC System
Description
An annoying edge case creates a bad interaction between fluid.construct and fluid.computeDistributionPriority -> fluid.getMemberNames.
If there is a global distribution which is capable of hitting components which are directly attached to the root, e.g.
fluid.defaults("fluid.authoring.nexus.componentTracker", {
gradeNames: ["fluid.component", "fluid.resolveRoot"],
distributeOptions: {
modelTracker: {
record: "fluid.authoring.nexus.modelTracker",
target: "{/ fluid.modelComponent}.options.gradeNames"
}
}
});
using fluid.construct, say, with a path of "sample-model-component-0" to construct a component directly attached to the root will trigger a failure
TypeError: Cannot read property 'id' of undefined
at Object.fluid.getMemberNames (E:\\source\\gits\\fluid-authoring\\node_modules\\infusion\\src\\framework\\core\\js\\FluidIoC.js:87:73)
since we don't handle the case where the path stack is empty. fluid.getMemberNames is pretty suspect anyway and has been ripe for fencepost errors for many years:
fluid.getMemberNames = function (instantiator, thatStack) {
var path = instantiator.idToPath(thatStack[thatStack.length - 1].id);
var segs = instantiator.parseEL(path);
// TODO: we should now have no longer shortness in the stack
segs.unshift.apply(segs, fluid.generate(thatStack.length - segs.length, ""));
return segs;
};
Comments
-
Cindy Li commented
2017-02-09T10:32:59.464-0500 The pull request https://github.com/fluid-project/infusion/pull/808 has been merged into the project repo master branch at f830efb6c0d36e505e4372e24cd89939ab79959f