Closed mschipperheyn closed 4 years ago
The workaround above actually doesn't "work". What is really happening is that transitive dataloading sometimes works and most of the time doesn't. The confusing part is that it seems to start working when I start console logging stuff to figure out why it doesn't work. It must be some kind of order of loading issue.
@mschipperheyn Hmm, i don't have any immediate ideas to what might be happening here.
@mickhansen Yeah, I realize not very actionable. Happy New Year!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I've followed the suggestions in https://github.com/mickhansen/graphql-sequelize/issues/670. But I'm still having an issues where the n+1 appears in some scenarios and those scenarios sometimes work normally.
It's really hard to debug. What would help hugely is a
debug
implementation where you could activeDEBUG=dataloader
and see dataloader hits and misses.Most of my issues occur in many to many
through
andhasOne
scenarios, although I never usethrough
and prefer instead to use an explicit intermediary class withbelongsTo
connections to the tables it connects. NormalhasMany
scenarios seem ok, but when I have ahasMany
to a table that only contains an id to the table we're actually interested in, I often see n+1 stylefor each post in an array. Subsequently, I see
However, when I customize the resolver like so:
it works as expected.
I created a little resolver wrapper for myself to help with this. But it should not be necessary to pass the dataloader to achieve transitive dataloading. It may be something that's wrong with my setup, but it looks like a bug.