profile
viewpoint
Yasuyuki Komatsubara kyasu1 Japan

kyasu1/elm-native-ui-maps 4

elm binding to react-native-maps

kyasu1/elm-ulid 2

Generator for ULID in Elm

kyasu1/category-selector 1

Elm category selector client

kyasu1/auth0-rocket-rust-example 0

Rocket app that authenticates users with Auth0

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 6dedc0ba4ff78e7cb876840c72fc6e7858abd98b

Commit Stock info 2021-12-06T01:00:00+00:00

view details

push time in 11 hours

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 7f1375f291e49946a21a2ac9eddb771b3ad18567

Commit Stock info 2021-12-03T01:00:00+00:00

view details

push time in 3 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha fbc720765ccdfb2b154a7d2cbcc6101288b9a3a0

Commit Stock info 2021-12-02T01:00:00+00:00

view details

push time in 4 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 89c932a084fe4ab63a20f87c5ad7f0448d14ab64

Commit Stock info 2021-12-01T01:00:00+00:00

view details

push time in 5 days

delete branch kyasu1/elm-graphql

delete branch : serialize-by-ordered-dict

delete time in 6 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha bbacbb8728b36fee099cc6564c92286edcf68844

Commit Stock info 2021-11-30T01:00:00+00:00

view details

push time in 6 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha e72650c159f5cdf8417f72a132d2e8d6367a9c26

Commit Stock info 2021-11-29T01:00:00+00:00

view details

push time in 7 days

PR opened dillonkearns/elm-graphql

Preserve the serialization order for mutations

Hi!

I run into a problem when sending multiple mutations in a single request to Hasura server backed with PostgreSQL. The mutation query requires to execute update and insert operations sequentially in a transaction of PostgreSQL, however elm-graphql is serializing their GraphQL operations into alphabetical order which is the problem.

More specifically, with this code we expect the updateUser runs first then the insertUser.

SelectionSet.map2 Tuple.pair updateUser insertUser

However actually this is serialized to something like follows.

query: “mutation {
  insert_user12345: insert_user(…)
  update_user12345: update_user(…)
}”

With this query, Hasura issues PostgreSQL query in order of insert then update which will fail in my schema. I think this behavior is counter intuitive and can be a pitfall for users. Also I have searched a bit for another projects and I found this and GraphQL specs

http://spec.graphql.org/October2021/#sec-Normal-and-Serial-Execution

which says the execution order must be in serial for mutations.

The current implementation uses standard Dict package for serializing fields

https://github.com/dillonkearns/elm-graphql/blob/068056540eb566fdf888aa1620605173b7b96511/src/Graphql/Document/Field.elm#L127-L141

which cause serialization of the fields in alphabetical order.

To prevent this re-ordering, in this PR, I have naively replaced it with j-mass/elm-ordered-containers and it seems to give us the expected result.

Thanks

+3 -1

0 comment

2 changed files

pr created time in 7 days

create barnchkyasu1/elm-graphql

branch : serialize-by-ordered-dict

created branch time in 7 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 8c4105f0c62d1e1ed3012fc04f65595df278f069

update market

view details

push time in 9 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 4cd635403c07ef6399546fbb019e35a02b94955c

Commit Stock info 2021-11-26T01:00:00+00:00

view details

push time in 10 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha d4dd69968df674f5b832ef5958cf539e7a3ff8f6

Commit Stock info 2021-11-25T01:00:00+00:00

view details

push time in 11 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha e7b3a486dbc669d0c00a910fb1e4d87654c02cb3

Commit Stock info 2021-11-24T01:00:00+00:00

view details

push time in 12 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 50772b1828914d2639ec6464cc7ee3d8311cf248

update market

view details

push time in 13 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha c74b966b17dad789434cfe9fa172d21348926835

Commit Stock info 2021-11-22T01:00:00+00:00

view details

push time in 14 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 00b98f76abe7276a77b1bdd7a9d165beacd8feb8

update market

view details

push time in 16 days

startedxocolatl/periods

started time in 17 days

startedarkhipov/temporal_tables

started time in 17 days

startedgoogle/budoux

started time in 17 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 35b194789e6b649b31bcdf6df3196b00291acb83

Commit Stock info 2021-11-19T01:00:00+00:00

view details

push time in 17 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 428536f3a0c1d42b1d95ba032a66d5b655220bfc

Commit Stock info 2021-11-18T01:00:00+00:00

view details

push time in 18 days

startedswc-project/swc

started time in 19 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 7bbed2ae173770e71deab6bd9b09f46f9d9e70b0

Commit Stock info 2021-11-17T01:00:00+00:00

view details

push time in 19 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha d26eae1e357bef11fd28df89b3bc2e06aa118998

Commit Stock info 2021-11-16T01:00:00+00:00

view details

push time in 20 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha c7c8ea0cccfc02af4de146004931dc1973a39bd8

Commit Stock info 2021-11-15T01:00:00+00:00

view details

push time in 21 days

startediced-rs/iced

started time in 24 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha c363b95c3fe8ba12658887ccae0f0dd740c52432

Commit Stock info 2021-11-12T01:00:00+00:00

view details

push time in 24 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 51be8c08f59b8b3cb18bc268fe82c03c39c9b605

Commit Stock info 2021-11-11T01:00:00+00:00

view details

push time in 25 days

push eventkyasu1/officeiko-2018

Yasuyuki Komatsubara

commit sha 620b12ea35554ea634a4a1ca4b679c37d31bc871

Commit Stock info 2021-11-10T01:00:00+00:00

view details

push time in a month

more