Skip to content

Spreading props causes issues with unused-fields #116

Description

@VictorGlindasPaf

Passing fields into components by spreading shows them as unused by the relay/unused-fields, while passing them one by one does not cause any issues.

type Props = {
  data: ParentComponent_data;
};

const ParentComponent: FC<Props> = ({ data }) => {
  const { title, ...rest } = data;
  return <SharedComponent title={title} {...rest} />;
}

export default createFragmentContainer(ParentComponent, {
  data: graphql`
    fragment ParentComponent_data on Data {
       name # <- Triggers a warning about not being used!
       title
    }
  `,
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions