kirillplatonov / shopify_graphql

Less painful way to work with Shopify Graphql API in Ruby.
MIT License
59 stars 9 forks source link

Refactor to retrieve data with one query #27

Closed remy727 closed 1 year ago

remy727 commented 1 year ago

Before

We were using 2 queries to retrieve resources - one without the cursor and one with.

After

We can use one query.

Note - cursor type needs to be String, not String!

Closes #26

kirillplatonov commented 1 year ago

Great! Thank you so much 👍

resistorsoftware commented 1 year ago

Much appreciated. That being said, please test this out a little. I have been using it in my Apps but on occasion, Shopify has not been playing nice with cursors. By that I mean the following:

Say I have 10 records. If my LIMIT is 3, making the query cost cheap, sometimes the paging info on the intro call comes back without paging info! That then screws up with the while loop as it expects a boolean to work with. Can I repro this every time ---> No! Just saying, it has happened.

Second, say I have 10 valid records, and I query for a LIMIT of 3. Using filter and cursor parameters, I do get back records, and it does work, but there are times I get back zero records for the same query when the limit is increased to say 5 or 6. Why is that? A 3 should return 3/10 records, end of the story. Again, I cannot repro this every single time, but it has happened enough that is frustrates me.

Just looking out for any kind of cursor-based anomalies from anyone else using this library!!