datocms / plugins

Repository providing samples using the Plugins SDK
MIT License
33 stars 47 forks source link

[Table] Renaming a Column will change the order of properties in object #67

Closed jordykoppen closed 2 years ago

jordykoppen commented 2 years ago

Hey, I'm running into a bug in production concerning the Table plugin:

Whenever I rename a column, the order of the data being returned by Dato API changes.

Example Table: Column A Column B Column C
Value 1 Value 2 Value 3

API returns:

{
  "columns": [
    "Column A",
    "Column B",
    "Column C"
  ],
  "data": [
    {
      "Column A": "Value 1",
      "Column B": "Value 2",
      "Column C": "Value 3"
    }
  ]
}

However, if we rename Column B to Column B2 through the Table Editor, the API result will be:

{
  "columns": [
    "Column A",
    "Column B",
    "Column C"
  ],
  "data": [
    {
      "Column A": "Value 1",
      "Column C": "Value 3",
      "Column B2": "Value 2"
    }
  ]
}
stefanoverna commented 2 years ago

Fixed in the latest version of the plugin, please upgrade! :)