Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

How to pass nested fragments #394

@baconcheese113

Description

@baconcheese113

If I have a query and fragments like below

query Home {
  user {
    id
    ...fragment1_user
  }
}

fragment fragment1_user on User {
  __typename
  id
  firstName
  ...fragment2a_user
  ...fragment2b_user
}

fragment fragment2a_user on User {
   __typename
  id
  lastName
}

fragment fragment2b_user on User {
  __typename
  id
  email
}

When I try to pass the props to their child widgets inside the Fragment1 Widget:

Fragment2aWidget(userFrag: widget.userFrag),
Fragment2bWidget(userFrag: widget.userFrag),

I get the following errors:

The argument type 'Fragment1UserMixin' can't be assigned to the parameter type 'Fragment2aUserMixin'.
The argument type 'Fragment1UserMixin' can't be assigned to the parameter type 'Fragment2bUserMixin'.

From the Home to Fragment1 widgets I see I'm able to pass Home$Query$User to the Fragment1UserMixin type, but I can't pass the others. I could probably just cast to the child mixin types, but that prevents static analysis on the values I'm passing in.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions