Querying subitems returns unexpected results

I have a simple board with items that include a few subitems. Using the GQL API I’m seeing some odd behavior in my query results:

The column_values data in each of my returned subitems always reflects the first subitem’s column_values, even though these subitems contain different column dropdown, text, and link field values. The subitem ids and names are correct and unique.

query example:

items(ids: [2916462227, 2916500373]) {
    id
    name
    column_values {
      id
      value
      text
    }
  }

I’ve also tried querying the parent:

items(ids: [2916537441) {
  id
  subitems {
    id
    name
    column_values {
      id
      value
      text
    }
  }
}

Hello @jimmythigpen and welcome to the community!

I hope you like it here :muscle:

Would you be able to send screenshots or a screen recording (please do not share any sensitive information) with the information you have in your board, the query and the result you get?

Please show in them the subitems selected and their IDs in the browser’s address bar as well.

Looking forward to hearing from you :slightly_smiling_face:

Cheers,
Matias

Thanks @Matias.Monday - I think I figured out that client side caching is the root of the issue since using the no-cache cache policy with apollo client resolves this.

I think this happened because apollo’s default caching mechanism uses __typename & id or _id as the cache id. This causes an issue with multiple column_values because the id field is used as a field identifier vs a unique id.

docs: Caching in Apollo Client - Apollo GraphQL Docs

Is there a unique field y’all recommend using for caching Monday API data?

1 Like

Hello again @jimmythigpen!

I am glad you found the source of the issue :slightly_smiling_face:

To be transparent with you, I do not have much experience with caching so I would not know what to recommend in that case. Let’s hope someone else from the community knows!

Cheers,
Matias

1 Like