Giter Club home page Giter Club logo

Comments (5)

kryops avatar kryops commented on May 25, 2024

I did some experiments in a fork, and stumbled upon the skipped test it should handle duplicate object type fields with different arguments that should cover this case. I added my own test in kryops@d6e1a26

The best I could come up with for now is a workaround: kryops@f75a574

  • If a field has an alias, it is not only written to row[fieldName], but also to row[fieldName + '$' + alias]
  • Fields with args have to set resolve: aliasAwareResolver, which prefers the aliased key over the default one
  • I did not look at pagination as we use SQLite which currently does not support it

While this is still far from a viable solution, maybe it could be used as a starting point for a proper fix?

from join-monster.

kryops avatar kryops commented on May 25, 2024

Ah, I finally found #126, so it seems I created a duplicate 😕

from join-monster.

neilgaietto avatar neilgaietto commented on May 25, 2024

I just recently ran into this issue as well. Its surprising that its a bug that's been around for years because it seems like its such a common use case. I can assist where needed to help get this fix out.

from join-monster.

kryops avatar kryops commented on May 25, 2024

While my workaround seems to work quite well for 1:n relationships, it seems to fail miserably for aliased 1:1 relationships because @stem/nesthydrationjs does not like hydrating the same source fields into multiple nested targets - instead it just sets everything to null 😞

const { nest } = require('@stem/nesthydrationjs');

console.log(nest(
  { id: '1', foo: 'bar' },
  {
    id: 'id',
    child: { foo: 'foo' },
    child$alias: { foo: 'foo' },
  }
));

// { id: '1', child: null, 'child$alias': null }

from join-monster.

kryops avatar kryops commented on May 25, 2024

I am closing this in favor of #126

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.