From b218337ffa9693c82400f854def18afc60b08f4b Mon Sep 17 00:00:00 2001 From: Kenan Warren Date: Tue, 11 Dec 2018 09:45:40 -0800 Subject: [PATCH] Fix filter id applied incorrectly to get many ref Fixes issue #2571 --- packages/ra-data-graphql-simple/src/buildVariables.js | 3 +-- packages/ra-data-graphql-simple/src/buildVariables.test.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/ra-data-graphql-simple/src/buildVariables.js b/packages/ra-data-graphql-simple/src/buildVariables.js index 6722b7ac7e..87cc35a5a4 100644 --- a/packages/ra-data-graphql-simple/src/buildVariables.js +++ b/packages/ra-data-graphql-simple/src/buildVariables.js @@ -169,9 +169,8 @@ export default introspectionResults => ( }; case GET_MANY_REFERENCE: { const parts = params.target.split('.'); - return { - filter: { [parts[0]]: { id: params.id } }, + filter: { [`${parts[0]}Id`]: params.id }, }; } case GET_ONE: diff --git a/packages/ra-data-graphql-simple/src/buildVariables.test.js b/packages/ra-data-graphql-simple/src/buildVariables.test.js index f19e8b4538..13daf87157 100644 --- a/packages/ra-data-graphql-simple/src/buildVariables.test.js +++ b/packages/ra-data-graphql-simple/src/buildVariables.test.js @@ -142,7 +142,7 @@ describe('buildVariables', () => { {} ) ).toEqual({ - filter: { author: { id: 'author1' } }, + filter: { authorId: 'author1' }, }); }); });