graphql/dataloader

[QUESTION] Is possible chain two dataloaders?

Open

#229 aberto em 20 de nov. de 2019

Ver no GitHub
 (1 comment) (3 reactions) (0 assignees)JavaScript (556 forks)batch import
help wanted

Métricas do repositório

Stars
 (12.520 stars)
Métricas de merge de PR
 (Mesclagem média 5d 2h) (1 fundiu PR em 30d)

Description

Hi, is it possible chain two dataloaders? I have one resolver where I need using two dataloaders, is it possible? I can't use SQL join because it's slow.

async (row, _, { dataSources }) => {
    const partialData = await dataloader1(dataSources).load(row.id);
    if (partialData === null) {
        return null;
    }
    return await dataloader2(dataSources).load(partialData.id);
}

Guia do colaborador