Hey Dipro,
Sure thing. I’ve since found out also that the output changes depending on whether I request the column_values.id or not - with the id field in the request, I get back the incorrect, repeated first value data, whereas without it I get the correct stuff.
Here is the output for the first 2 items in boardsd0].items
, firstly with the id
in the request:
{
__typename: 'Item',
name: 'List of staff',
group: {
__typename: 'Group',
id: 'new_group123',
title: 'Staff rostering'
},
column_values: :
{
__typename: 'ColumnValue',
id: 'subitems',
value: null,
text: ''
},
{
__typename: 'ColumnValue',
id: 'person',
value: '{"changed_at":"2021-12-21T10:55:16.798Z","personsAndTeams":"{"id":12345678,"kind":"person"}]}',
text: 'Brian'
},
{
__typename: 'ColumnValue',
id: 'status0',
value: '{"index":4,"post_id":null,"changed_at":"2021-11-22T13:04:53.044Z"}',
text: 'Medium'
},
{
__typename: 'ColumnValue',
id: 'status',
value: '{"index":1,"post_id":null,"changed_at":"2021-11-22T13:04:54.962Z"}',
text: 'Done'
},
{
__typename: 'ColumnValue',
id: 'date',
value: '{"date":"2021-12-14","changed_at":"2021-12-14T14:25:27.274Z"}',
text: '2021-12-14'
},
{ __typename: 'ColumnValue', id: 'numbers', value: null, text: '' },
{ __typename: 'ColumnValue', id: 'files', value: null, text: '' },
{
__typename: 'ColumnValue',
id: 'progress_tracking',
value: null,
text: ''
}
]
}
{
__typename: 'Item',
name: 'Set up to be completed',
group: {
__typename: 'Group',
id: 'new_group123',
title: 'Staff rostering'
},
column_values: :
{
__typename: 'ColumnValue',
id: 'subitems',
value: null,
text: ''
},
{
__typename: 'ColumnValue',
id: 'person',
value: '{"changed_at":"2021-12-21T10:55:16.798Z","personsAndTeams":"{"id":12345678,"kind":"person"}]}',
text: 'Brian'
},
{
__typename: 'ColumnValue',
id: 'status0',
value: '{"index":4,"post_id":null,"changed_at":"2021-11-22T13:04:53.044Z"}',
text: 'Medium'
},
{
__typename: 'ColumnValue',
id: 'status',
value: '{"index":1,"post_id":null,"changed_at":"2021-11-22T13:04:54.962Z"}',
text: 'Done'
},
{
__typename: 'ColumnValue',
id: 'date',
value: '{"date":"2021-12-14","changed_at":"2021-12-14T14:25:27.274Z"}',
text: '2021-12-14'
},
{ __typename: 'ColumnValue', id: 'numbers', value: null, text: '' },
{ __typename: 'ColumnValue', id: 'files', value: null, text: '' },
{
__typename: 'ColumnValue',
id: 'progress_tracking',
value: null,
text: ''
}
]
}
And then without the id
field:
{
__typename: 'Item',
name: 'List of staff created',
group: {
__typename: 'Group',
id: 'new_group123',
title: 'Staff rostering'
},
column_values: :
{ __typename: 'ColumnValue', value: null, text: '' },
{
__typename: 'ColumnValue',
value: '{"changed_at":"2021-12-21T10:55:21.978Z","personsAndTeams":"{"id":12345678,"kind":"person"}]}',
text: 'Brian'
},
{
__typename: 'ColumnValue',
value: '{"index":4,"post_id":null,"changed_at":"2021-11-22T13:04:57.856Z"}',
text: 'Medium'
},
{
__typename: 'ColumnValue',
value: '{"index":1,"post_id":null,"changed_at":"2021-11-22T13:04:59.798Z"}',
text: 'Done'
},
{
__typename: 'ColumnValue',
value: '{"date":"2021-12-28","changed_at":"2021-12-14T14:25:30.134Z"}',
text: '2021-12-28'
},
{ __typename: 'ColumnValue', value: null, text: '' },
{ __typename: 'ColumnValue', value: null, text: '' },
{ __typename: 'ColumnValue', value: null, text: '' }
]
}
{
__typename: 'Item',
name: 'Set up to be completed on Teamnet including resource booking',
group: {
__typename: 'Group',
id: 'new_group123',
title: 'Staff rostering'
},
column_values: :
{ __typename: 'ColumnValue', value: null, text: '' },
{
__typename: 'ColumnValue',
value: '{"changed_at":"2021-12-21T10:55:27.420Z","personsAndTeams":"{"id":12345678,"kind":"person"}]}',
text: 'Brian'
},
{
__typename: 'ColumnValue',
value: '{"index":2,"post_id":null,"changed_at":"2021-11-22T13:05:08.208Z"}',
text: 'High'
},
{
__typename: 'ColumnValue',
value: '{"index":1,"post_id":null,"changed_at":"2021-12-03T15:46:10.576Z"}',
text: 'Done'
},
{ __typename: 'ColumnValue', value: null, text: '' },
{ __typename: 'ColumnValue', value: null, text: '' },
{ __typename: 'ColumnValue', value: null, text: '' },
{ __typename: 'ColumnValue', value: null, text: '' }
]
}
Probs 2 big blocks of response there, but basically the ColumnValues for the two items should have (anonymised):
- Person: Brian, Priority: Medium, Status: Done
- Person: Brian, Priority: High, Status: Done
which they do, but only from the query with no id
field.
Hope that makes sense! I’ll see if I can spin up a minimal repro for it for you to check too.
B
@jesmodrazik that’s odd, had you changed your code at all?
I have managed to figure out what was going on with mine this evening, finally… it was a very awkward, but oddly simple, bug with Apollo - basically that in the column_values
edge(s), the array contained id
’s of the columns, which were being used by Apollo in the internal in-memory caching (separate to the overall caching of results) when the query is returned, and so couldn’t tell that they should be different.
Adding the following snippet into the cache
option in my apollo-client.ts
allows the correct results through from the query, thanks to this Stack Overflow answer 😂
const client = new ApolloClient({
uri: "https://api.monday.com/v2",
headers: {
"Content-Type": "application/json",
Authorization: process.env.MONDAY_API_TOKEN || "",
},
cache: new InMemoryCache({
dataIdFromObject: (o) => (o._id ? `${o.__typename}:${o._id}` : undefined),
}),
});
Hopefully if anyone else has a similar issue from the get-go with a v simple Apollo + Monday situation, this might save them a week or so of intermittent head-scratching…