Handling refs ('@ref') in javascript

Sorry if I’m missing something obvious, but I’m having a bit of trouble sending refs back and forth between my backend and frontend. When I paginate I get back something like this:

  "after": [
      "@ref": {
        "id": "287890180395762177",
        "collection": {
          "@ref": {
            "id": "foo",
            "collection": { "@ref": { "id": "collections" } }
   ... etc

When I try to pass this as the after key to paginate I get "Ref expected, Object provided.".
Do I have to manually turn it into refs, somewhat like:

after: after.map((el) =>  q.Ref(q.Collection('foo'), el['@ref'].id))

Or is there an intended solution for this?

Hi @jescowuester. This is very related to question such as some issues raised on our driver such as these ones:

Instead of passing the ref to your frontend you want to get the id out of that ref and instead construct the ref again in your backend once your frontend provides you with the id.

Ref(Collection("..."), "287890180395762177")

Not ideal, I know, we’re hoping to make it easier to serialize/deserialize these references in the future. A ticket has been made internally.