From 7613692379bb9f67c0879d51d73fc573bbc60e62 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 14 Oct 2020 18:04:21 +0100 Subject: [PATCH 1/2] Fixing a bug where if you created a column without a name editting it would create another column and also adding an option to remove sorting from your table. --- packages/builder/src/builderStore/store/backend.js | 3 ++- .../backend/DataTable/popovers/ColumnPopover.svelte | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index d89796f9cc..6500febb2d 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -94,7 +94,8 @@ export const getBackendUiStore = () => { saveField: ({ originalName, field }) => { store.update(state => { // delete the original if renaming - if (originalName) { + // need to handle if the column had no name, empty string + if (originalName || originalName === "") { delete state.draftTable.schema[originalName] state.draftTable._rename = { old: originalName, diff --git a/packages/builder/src/components/backend/DataTable/popovers/ColumnPopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/ColumnPopover.svelte index e4db32d900..071d8038bf 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/ColumnPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/ColumnPopover.svelte @@ -43,7 +43,11 @@ function sort(direction, column) { backendUiStore.update(state => { - state.sort = { direction, column } + if (direction !== "none") { + state.sort = {direction, column} + } else { + state.sort = undefined + } return state }) hideEditor() @@ -70,6 +74,12 @@ Delete + {#if sortDirection === 'desc' || sortDirection === 'asc'} +
  • sort('none', field.name)}> + + Remove sort +
  • + {/if} {#if sortDirection === 'desc' || sortColumn !== field.name}
  • sort('asc', field.name)}> From 94ceff1bbd1f2abd917c50dbadc8ee824b5cf168 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Wed, 14 Oct 2020 20:05:13 +0100 Subject: [PATCH 2/2] Fixing an issue where linked record column deletion was not correctly removing relationships. --- packages/server/src/api/controllers/table.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/table.js b/packages/server/src/api/controllers/table.js index f6fb2b7627..efcb58410e 100644 --- a/packages/server/src/api/controllers/table.js +++ b/packages/server/src/api/controllers/table.js @@ -36,7 +36,10 @@ exports.save = async function(ctx) { let renameDocs = [] // if the table obj had an _id then it will have been retrieved - const oldTable = ctx.preExisting + let oldTable + if (ctx.request.body && ctx.request.body._id) { + oldTable = await db.get(ctx.request.body._id) + } // rename row fields when table column is renamed const { _rename } = tableToSave