Skip to content

relay/generated-flow-types not working with useMutation hooks #154

Open
@zygopleural

Description

Code setup as follows:

...

import type { DashboardPageUserViewedDashboardMutation } from "./__generated__/DashboardPageUserViewedDashboardMutation.graphql"

...

export default function DashboardPage() {
  ...
  
  const [userViewedDashboardMutation] =
    useMutation<DashboardPageUserViewedDashboardMutation>(graphql`
      mutation DashboardPageUserViewedDashboardMutation {
        userViewedDashboard {
          viewedDashboard
        }
      }
    `)

  ...
  
}

...

Setting "relay/generated-flow-types": "error"

Gives the following issue:

Screenshot 2024-11-29 at 15 00 33

I see a test case for the failure condition here https://github.com/relayjs/eslint-plugin-relay/blob/main/test/generated-typescript-types.js#L538-L552 but no corresponding passing condition test.

From what I can see in the source code here https://github.com/relayjs/eslint-plugin-relay/blob/main/src/rule-generated-flow-types.js#L567-L583 what I have should not be an issue.

Looks like this was added by @tyao1 via 3d1ebcd so maybe they can advise.

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