FLUID-5077: Cannot add the same listener to multiple paths for the same ChangeApplier event

Metadata

Source
FLUID-5077
Type
Bug
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Antranig Basman
Created
2013-07-02T04:01:32.458-0400
Updated
2015-06-17T10:31:30.709-0400
Versions
  1. 1.4
Fixed Versions
N/A
Component
  1. Data Binder

Description

Discovered during pager rewrite for FLUID-4035. In the following sequence, we want the same listener to guard two paths:

that.applier.postGuards.addListener({path: "pageSize", transactional: true},
fluid.pager.pageCountGuard);
that.applier.postGuards.addListener({path: "totalRange", transactional: true},
fluid.pager.pageCountGuard);

As a result of the sleazy "implementation sharing" with the underlying Fluid event firer, the system recognises this as an attempt to add the same listener which is given the same namespace each time and so dislodges itself. It would probably be better just to get rid of the implementation sharing given this complicates the implementation both of the basic Fluid events system (with its peculiar "fireToListeners" method) and DataBinding alike.

Comments

  • Antranig Basman commented 2014-11-18T20:22:46.594-0500

    This issue was resolved as part of the FLUID-4258 model relay-aware "new ChangeApplier" work. "Guards" are removed and the configuration achieving the above effect looks like this:

    modelRelay: [{
    target: "pageCount",
    singleTransform: {
    type: "fluid.transforms.free",
    args: {
    "totalRange": "{that}.model.totalRange",
    "pageSize": "{that}.model.pageSize"
    },
    func: "fluid.pager.computePageCount"
    }

    (from Pager.js)