Uploaded image for project: 'Fluid Infusion'
  1. Fluid Infusion
  2. FLUID-5608

fluid.transforms.valueMapper does not support "false" literal target values

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      The fluid.transforms.valueMapper function contains the following logic:

      var indexed = deref(value);
      if (!indexed) {
          // if no branch matches, try again using this value - WARNING, this seriously
          // threatens invertibility
          indexed = deref(transformSpec.defaultInputValue);
      }
      if (!indexed) {
          return;
      }
      

      https://github.com/fluid-project/infusion/blob/master/src/framework/core/js/ModelTransformationTransforms.js#L258-L266

      If deref() finds a "false" literal value, it will be treated as no value found. This results in code like the following being necessary:

      singleTransform: {
          type: "fluid.transforms.valueMapper",
          inputPath: "",
          defaultInputValue: "otherwise",
          options: {
              "checked": true,
              "indeterminate": true,
              "otherwise": { outputValue: false }
          }
      }
      

      The use of "

      { outputValue: false }

      " is necessary to give deref() a non-falsey value.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kaspermarkus Kasper Galschiot Markus
              Reporter:
              simon Simon Bates
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: