FLUID-4861: Invokers are getting created even if they are not set in the component configuration

Metadata

Source
FLUID-4861
Type
Bug
Priority
Major
Status
Open
Resolution
N/A
Assignee
Antranig Basman
Reporter
Alexey Novak
Created
2012-12-07T13:10:20.527-0500
Updated
2022-07-15T06:14:26.416-0400
Versions
  1. 1.5
Fixed Versions
N/A
Component
  1. Framework
  2. IoC System

Description

Invokers are get assigned to

function() {
            var args = fluid.makeArray(arguments);
            // FLUID-4712: properly contextualise invoker so that any new constructions are not corrupted
            return fluid.withInstantiator(that, function(instantiator) {
                var invokeSpec = fluid.embodyDemands(instantiator, that, demandspec, args, {passArgs: true});
                return fluid.invokeGlobalFunction(invokeSpec.funcName, invokeSpec.args, environment);
            }, ["    while invoking invoker with name " + functionName + " on component", that], userInstantiator);
        }

If they are assigned to null in the configuration of the component which can potentially cause a JavaScript error if developer will try to call them in the finalInit.

I created a branch which has the test for this issue: https://github.com/anvk/infusion/tree/FLUID-4861
Test file to run is: infusion/src/webapp/tests/framework-tests/core/html/FluidIoC-test.html

Comments

  • Antranig Basman commented 2012-12-11T23:32:27.877-0500

    Thanks, Alexey - this is indeed a kind of bug in that the framework behaviour is not entirely helpful. However, this highlights the design issue that invokers are primarily designed to cover cases where there is definitely exactly one implementation intended to cover the operation. In the case where the multiplicity of implementations might vary (including varying to zero as you have in this report), it is more appropriate to use a Fluid event to define the operation rather than an invoker. We should definitely fix the issue you have reported, but I think it is of relatively low priority given that the use of an undefined invoker (null) represents a non-ideal use of the framework.

    Until the issue is fixed properly, you can work around it by assigning the invoker to the "do-nothing" function fluid.identity rather than to null.

  • Alexey Novak commented 2012-12-12T09:00:12.894-0500

    Thanks for such a detailed reply Antranig. I will try to use fluid.identity in the meantime and maybe even rethink the structure of the component I have.