# Missing dynamic GraphQL context with CMS React

**URL:** <https://community.hubspot.com/t/missing-dynamic-graphql-context-with-cms-react/103782>\
**Category:** CMS Development\
**Created:** [March 30, 2024, 2:43pm UTC](https://community.hubspot.com/t/missing-dynamic-graphql-context-with-cms-react/103782 "2024-03-30T14:43:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![royyanbach](https://avatars.discourse-cdn.com/v4/letter/r/ed8c4c/32.png) [@royyanbach](https://community.hubspot.com/u/royyanbach)\
**Post date:** [March 30, 2024, 2:43pm UTC](https://community.hubspot.com/t/missing-dynamic-graphql-context-with-cms-react/103782/1 "2024-03-30T14:43:05Z")

</div>

Hi! Is there anyway we can pass dynamic context to the graphql query when used with CMS React?  
Using this simlpe query doesn’t work:

```lia-code-sample
export const query =`
# $product_uid: "foo"
query MyQuery($product_uid: String!) {
 HUBDB {
 my_product_collection(limit: 3, filter: {product_uid__contains: $product_uid}) {
 items {
 product_name
 }
 }
 }
}
`

```

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [April 1, 2024, 7:32pm UTC](https://community.hubspot.com/t/missing-dynamic-graphql-context-with-cms-react/103782/2 "2024-04-01T19:32:27Z")

</div>

Hey, @royyanbach 👋 Thanks for the question. I’d like to invite some of our community members to the conversation — @Teun @Kevin-C @ChrisoKlepke do you have any recent experience here?

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![noerbot-a8](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@noerbot-a8](https://community.hubspot.com/u/noerbot-a8)\
**Post date:** [March 26, 2025, 7:28pm UTC](https://community.hubspot.com/t/missing-dynamic-graphql-context-with-cms-react/103782/3 "2025-03-26T19:28:38Z")

</div>

@royyanbach I believe your approach should work when deployed, as we’ve successfully used that approach numerous times. It just doesn’t work when running the project locally for some reason. 😕

---

<div class="post-metadata">

**Author:** ![noerbot-a8](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@noerbot-a8](https://community.hubspot.com/u/noerbot-a8)\
**Post date:** [April 1, 2025, 10:54pm UTC](https://community.hubspot.com/t/missing-dynamic-graphql-context-with-cms-react/103782/4 "2025-04-01T22:54:43Z")

</div>

@royyanbach if you need the query to work locally, you can set a default value for $product\_uid like so:

```lia-code-sample
export const query =`
# $product_uid: "foo"
query MyQuery($product_uid: String! = "foo") {
 HUBDB {
 my_product_collection(limit: 3, filter: {product_uid__contains: $product_uid}) {
 items {
 product_name
 }
 }
 }
}

```
