FLUID-6586: References into local record such as {source} and {sourcePath} can't be resolved in interpolated relay segments

Metadata

Source
FLUID-6586
Type
Bug
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Antranig Basman
Created
2021-01-01T15:01:05.451-0500
Updated
2024-07-17T08:12:45.916-0400
Versions
N/A
Fixed Versions
  1. 3.0
Component
  1. Framework

Description

In a silly oversight, we failed to supply the localRecord argument when expanding interpolating path segments in relay rules. The following definition from the covid data monitor app fails to resolve:

modelRelay: {
                    source: {
                        context: "{map}",
                        segs: ["uiChecks", "{sourcePath}"]
                    },
                    target: "checked"
                }

Comments

  • Tony Atkins [RtF] commented 2022-03-24T06:12:55.267-0400

    Would this also explain why sourcePath can't be used in a dynamic component's model? Here's an example:

    fluid.defaults("fluid.demo.sourcePath", {
        gradeNames: ["fluid.component"],
        sources: ["peas", "porridge", "hot"],
        dynamicComponents: {
          example: {
            type: "fluid.modelComponent",
            sources: "{that}.options.sources",
            options: {
              model: {
                label: "{source}",
                index: "{sourcePath}"
              }
            }
          }
        }
      });
    

    This throws:

    src\framework\core\js\Fluid.js:2972 Uncaught TypeError: Cannot read properties of undefined (reading 'composeSegments')
        at Object.fluid.parseValidModelReference (src\framework\core\js\DataBinding.js:672:48)
        at Object.fluid.parseImplicitRelay (src\framework\core\js\DataBinding.js:1284:28)
        at src\framework\core\js\DataBinding.js:1306:36
        at Object.fluid.each (src\framework\core\js\Fluid.js:653:13)
        at Object.fluid.parseImplicitRelay (src\framework\core\js\DataBinding.js:1304:15)
        at src\framework\core\js\DataBinding.js:1390:22
        at Array.map (<anonymous>)
        at fluid.establishModelRelay (src\framework\core\js\DataBinding.js:1389:43)
        at Object.fluid.expander.invokeFunc [as typeFunc] (src\framework\core\js\FluidIoC.js:3512:17)
        at Object.fluid.expandImmediateImpl (src\framework\core\js\FluidIoC.js:3408:62)
    
  • Antranig Basman commented 2022-05-13T06:07:55.037-0400

    Unrelated to the fix of FLUID-6729 since without this feature it would have been impossible to store any {sourcePath} entries at all