#Discrepancy between local dev and production

10 messages · Page 1 of 1 (latest)

proud solstice
#

Hello

I have a collection with an array of objects. One of the fields in this array is a relation to another collection. This works fine locally but when I deploy the language relationship doesn't properly save, it always reverts back to the empty select box with "Select a value".

I can see the value being updated in the database though, if I look in the subjects_rel table I see the following:

| id | order | parent_id | path | task_languages_id
| 14 | | SVE | word2Columns.0.language | fi

but it's not reflected in the payload UI or via the API

How can I begin troubleshooting this?

export const Subjects: CollectionConfig = {
  slug: "subjects",
  fields: [
    // more fields
    {
      name: "word2Columns",
      type: "array",
      required: false,
      fields: [
        {
          name: "type",
          type: "select",
          required: true,
          options: [
            { label: "Ord", value: "word" },
            { label: "Bild", value: "image" },
          ],
        },
        {
          name: "name",
          type: "text",
          localized: true,
        },
        {
          name: "language",
          type: "relationship",
          relationTo: "task-languages",
          hasMany: false,
          required: true,
          localized: true,
          admin: {
            condition: (_, siblingData) => siblingData.type === "word",
          },
        },
      ],
    },
  ],
};
thick lynxBOT
proud solstice
#

bump

proud solstice
#

Last bump 🤞

winter drum
#

How does your hosting look like? Is it correctly stored in the DB?

proud solstice
#

I think so. I've compared the tables mentioned above and I can't see difference. Do you know if there any other tables I should check out too?

#

Maybe I should try to remove it and re-add it again 🤔

winter drum
#

If it is stored in the database correctly, the problem is related to retrieving the data from the database. Are there any readOperation hooks or read acces control methods that could interfere with the data in unexpected manners?

proud solstice
#

Not that I can see. And it works locally in dev mode. I'm gonna try building a production build locally

proud solstice
#

I solved by moving the localisation: true one level up, to the array itself