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

Erro on principal node is object #81

Open
heliocaruccio opened this issue Dec 30, 2021 · 0 comments
Open

Erro on principal node is object #81

heliocaruccio opened this issue Dec 30, 2021 · 0 comments

Comments

@heliocaruccio
Copy link

Hi in my query value returned is one object Project.find(id)

This schema return one error

Failed to build a GraphQL list result for field Project.Itemsat pathproject.items.\nExpected #<BatchLoader::GraphQL:0x000055f6101402b0 @batch_loader=#BatchLoader:0x62120>(BatchLoader::GraphQL) to implement.eachto satisfy the GraphQL return type[Item!].\n"

field :items, [Types::ItemType], null: true

def items
BatchLoader::GraphQL.for(object.id).batch(default_value: []) do |project_ids, loader|
Item.where(project_id: project_ids).each do |data|
loader.call(data.project_id) { |memo| memo << data }
end
end
end

One ideia?

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

No branches or pull requests

1 participant