I have a very strange behaviour and I need your help.
I retrieve a list of content from a GraphQl API that i attach you:
client.query({query: PAGES_LIST}).then(res => console.log(res.data.pages)
The problem is that the response from the network is that:
[
{
"id": "ddf",
"title": "DDF",
"type": "HOME",
"draft": false,
"newtonId": "64edfc8f3508bb20a9dbef19",
"creationDate": "2023-08-29 14:11:27",
"updatedDate": "2023-08-29 14:18:24",
"__typename": "Page"
},
{
"id": "home",
"title": "Aujourd'hui",
"type": "HOME",
"draft": false,
"newtonId": "649f004bdd86676fc0b4fb7e",
"creationDate": "2023-06-30 16:18:19",
"updatedDate": "2023-06-30 16:18:19",
"__typename": "Page"
},
{
"id": "home",
"title": "Aujourd'hui",
"type": "HOME",
"draft": true,
"newtonId": "64e4694ede8dac1164feabd4",
"creationDate": "2023-08-22 07:52:46",
"updatedDate": "2023-10-31 10:35:26",
"__typename": "Page"
},
{
"id": "newpage",
"title": "New Page",
"type": "HOME",
"draft": true,
"newtonId": "6540db14d9696820b319a6af",
"creationDate": "2023-10-31 10:46:44",
"updatedDate": "2023-10-31 10:46:44",
"__typename": "Page"
}
]
And the console.log from the client side is that. As you could see the item with the same id "home" is the same now:
[
{
"__typename": "Page",
"id": "ddf",
"title": "DDF",
"type": "HOME",
"draft": false,
"newtonId": "64edfc8f3508bb20a9dbef19",
"creationDate": "2023-08-29 14:11:27",
"updatedDate": "2023-08-29 14:18:24"
},
{
"__typename": "Page",
"id": "home",
"title": "Aujourd'hui",
"type": "HOME",
"draft": false,
"newtonId": "649f004bdd86676fc0b4fb7e",
"creationDate": "2023-06-30 16:18:19",
"updatedDate": "2023-06-30 16:18:19"
},
{
"__typename": "Page",
"id": "home",
"title": "Aujourd'hui",
"type": "HOME",
"draft": false,
"newtonId": "649f004bdd86676fc0b4fb7e",
"creationDate": "2023-06-30 16:18:19",
"updatedDate": "2023-06-30 16:18:19"
},
{
"__typename": "Page",
"id": "newpage",
"title": "New Page",
"type": "HOME",
"draft": true,
"newtonId": "6540db14d9696820b319a6af",
"creationDate": "2023-10-31 10:46:44",
"updatedDate": "2023-10-31 10:46:44"
}
]
How is it possibile and could I solve it ?
I excpect to see the same array that the newtowrk provides me.
3
Probably this
console
behavior. Something modified the array after you logged it.1 hour ago
I use the consol only for debugging. I'm trying to cycle it and merge the same into a unique object with the 2 newtonId and I found 2 identical newtonId
56 mins ago
use
console.log(JSON.stringify(yourarray))
instead and see if the issue persists19 mins ago