Skip to content

Support interpolation of route-conditional fragments that return an array of fragment references #896

Closed
@steveluscher

Description

@steveluscher

Presently there is a limitation in Relay that requires that any interpolation you perform in a Relay.QL block must evaluate to:

  • a fragment reference

    ${Foo.getFragment('viewer')}

  • an array of fragment references

    ${COMPONENTS.map(c => c.getFragment('viewer'))}

  • a route-conditional function that returns exactly one fragment reference

    ${route => COMPONENTS[route].getFragment('viewer')}

The task at hand is to enable the interpolation of route-conditional functions that return an array of fragment references.

${route => COMPONENTS.map(c => 
  c.getFragment('treasure').if(variables[`${route}Unlocked`])
)}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions