the-events-calendar / ql-events

The Events Calendar binding to WPGraphQL
15 stars 7 forks source link

`events` query does not return correct databaseId, eventsCategories data #64

Open hcavanaugh opened 5 months ago

hcavanaugh commented 5 months ago

Tested with: The Events Calendar 6.2.2.1, 6.2.3+ The Events Calendar Pro 6.2.4 QL Events 0.3.1

Since TEC 6.2.3, the databaseIds returned when performing an events query does not match the post ID. As a result, the eventsCategories nodes are returning empty, even though there are categories associated with those posts.

Here is the query results sample when running events(where: {startsAfter: "now", status: PUBLISH} first: 50) in 6.2.2.1:

        {
          "databaseId": 100211, //This is the ID seen in the post editor URL. Querying event(id: "100211", idType: DATABASE_ID) returns the same data
          "id": "cG9zdDoxMDAyMTE=",
          "title": "Test Event",
          "startDate": "2024-05-30 17:30:00",
          "eventsCategories": {
            "nodes": [
              {
                "name": "Conversations",
                "id": "dGVybTo0MQ=="
              }
            ]
          }
        }

Versus since 6.2.3:

{
          "databaseId": 10001167, //Querying event(id: "100211", idType: DATABASE_ID) returns the data seen in 6.2.2.1
          "id": "cG9zdDoxMDAwMTE2Nw==",
          "title": "Test Event",
          "startDate": "2024-05-30 17:30:00",
          "eventsCategories": {
            "nodes": [] 
          }
        }

This event sample is a single event, not recurring or part of a series. The issue is that we can't use TEC below 6.2.3, as that fixes the lodash error that occurs since WP 6.4. So we are in a stalemate on querying events until this is fixed.

hcavanaugh commented 5 months ago

Update: Recurring events in the event query are not returning any node content in eventCategories either. TEC REST API using the recurring event instance ID is returning event categories as expected. @kidunot89 I'm sure if you are still active on this project. This bug prevents us from using WPGraphQL not only for events queries, but event now as well.

danimalweb commented 3 months ago

I have the same issue. Any update? Would love to use eventsCategories but nothing is returned.