Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field ordering in nested fragments affects response decoding #24

Open
eliscie opened this issue Jan 14, 2023 · 1 comment
Open

Field ordering in nested fragments affects response decoding #24

eliscie opened this issue Jan 14, 2023 · 1 comment

Comments

@eliscie
Copy link

eliscie commented Jan 14, 2023

Hello!

Decoders generated by elm-gql seem to swap fields around if the fragment is nested alongside other fields.

Affected query:

query TestBuses {
  buses {
    id
    name
    rows
    seats {
      front
      ...SideSeats
      back
    }
  }
}

fragment SideSeats on Seats {
  rightRow # changed order! 
  leftRow
}

The query executed in the GraphiQL tool is fine:
Screenshot of graphiql.html

elm-gql-decoded query, unfortunately, is not:
Screenshot of index.html

However, a similar query (third column in the screenshot above), in which the fragment is not used alongside other fields, gets decoded correctly.

GitHub repository with issue reproduction: https://github.com/eliscie/city-parking
My original message on the Incremental Elm Discord server: https://discord.com/channels/534524278847045633/1018161791152431234/1063527955751506070
Possibly related message on the same server: https://discord.com/channels/534524278847045633/1018161791152431234/1048392743573008416

Thank you for making elm-gql.

@PsyfireX
Copy link

I also encountered this bug. I had to "flatten" a lot of my fragments, otherwise the decoders would have fields in the wrong order.

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

No branches or pull requests

2 participants