agentejo / cockpit

Add content management functionality to any site - plug & play / headless / api-first CMS
http://getcockpit.com
MIT License
5.4k stars 524 forks source link

Api returns old values for collectionlink fileds value #1469

Open drascom opened 3 years ago

drascom commented 3 years ago

hi everyone; i’m not native english speaker sorry for mistakes :), the problem is when i update a field via api which is added as a collection link to another collection, i can see this update at admin panel (backend) but api request gives me ald value of that field. also same issue mentioned here too https://discourse.getcockpit.com/t/bug-updates-to-linkcollection-such-as-name-show-in-the-ui-but-do-not-show-in-the-api-json/1454?u=drascom Api response is

    {
      "name": "ADANA",
      "_by": "e5089a44633938387e00010a",
      "_mby": "e5089a44633938387e00010a",
      "_modified": 1631363616,
      "teams": [
        {
          "_id": "507d226063326474930002ee",
          "link": "teams",
          "display": "DENEME" <----------  old value
        }
      ],

json from admin panel is

  "name": "ADANA",
  "_by": "e5089a44633938387e00010a",
  "_mby": "e5089a44633938387e00010a",
  "_modified": 1631363616,
  "teams": [
    {
      "_id": "507d226063326474930002ee",
      "link": "teams",
      "display": "DENEME2" <--------------   new value
    }
  ],

i noticed collection link field is not really updating when i'm updating the source table fields. when i open the admin panel it is requesting related fields data from it’s own collection each time . i’m seeing old value because i’m only requesting main collection and not fetching collectionlinks fileds values from related table.

it is a bug isnt it ?

ealbinu commented 3 years ago

I'm getting exactly the same thing