Giter Club home page Giter Club logo

Comments (7)

nicoabie avatar nicoabie commented on May 23, 2024 1

The the problem was that the two disjoint fields where coming from the db in different objects.
So the latter overrode the first one, that is why you were alway having just one of those.

Now I check if we have a result that is an object and a new piece comes, we just merge it.

{ author: { capitalizedLastName: "..." } } + { author: { email: "..." } } = { author: { capitalizedLastName: "...", email: "..." } }

in the end I was able to fix both modes with same approach in different places:

obj[fieldName] = Object.assign(
fix for batch mode

Object.assign(obj[fieldName], qualifiedValue)
fix for join mode

from join-monster.

nicoabie avatar nicoabie commented on May 23, 2024

@Grundlefleck I'd love your input in the solution I've proposed #519

And If you can tell me if you have a test for sqlBatch or how did you know it would not work there.

Thanks for such a detailed issue, investigation, pull request and patience.

from join-monster.

nicoabie avatar nicoabie commented on May 23, 2024

I added this test 06f2a26 and it passes in both batch and join modes.

I also tested that on master. with same results.

Note that there is an extra object, I believe disjoint fields need more work.

We could merge my PR that make multiple disjoint fields work in join mode which solves @Grundlefleck

Then work in PRs addressing:

  • multiple disjoint in batch mode
  • remove extra object in single disjoint in batch mode
  • remove extra object in single disjoint in join mode

from join-monster.

nicoabie avatar nicoabie commented on May 23, 2024

fixed by #519

from join-monster.

Grundlefleck avatar Grundlefleck commented on May 23, 2024

Hi @nicoabie thanks for looking into it.

@Grundlefleck I'd love your input in the solution I've proposed #519

I confess I don't really understand how it works, but probably it's because I can't visualise the runtime types when moveProp is called. Is the strategy to merge (via Object.assign) the field representing the unioned type? So in the example test case, the author field would be like: { capitalizedLastName: "...", email: "..." } and that would be passed back?

And If you can tell me if you have a test for sqlBatch or how did you know it would not work there.

Only from running e.g. npm run test which would execute the same tests using STRATEGY=batch. I didn't even consider batch mode until I ran the test suite... which is a sign of a great test suite! 😄

Thanks for such a detailed issue, investigation, pull request and patience.

No, thank you.

from join-monster.

Grundlefleck avatar Grundlefleck commented on May 23, 2024

we just merge it.

Gotcha. I had in my head that the resultant object needed to match the fields being requested, and that any extra fields not requested in the GQL query input might trip some validation.

Not sure where I got that from, but if it's not a concern then making all fields available is way simpler than trying to wrangle a call to resolveType().

from join-monster.

nicoabie avatar nicoabie commented on May 23, 2024

Yes, It will match exactly the fields requested. The thing is that the fields came is different objects. That's all :)

from join-monster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.