From a50c3736310927d76024c4498c7f03055e932290 Mon Sep 17 00:00:00 2001 From: Chaiwat Ekkaewnumchai Date: Mon, 8 Jun 2020 08:57:33 -0700 Subject: [PATCH] Calculate Editable when Used Summary: In D21788243, John suggested the field should be calculated when needed not precomputed. This diff does so by moving calculation logic to the component and removing the field This also fixes the crashing bug when switching to Structure tab, changing table, and switching back to Data tab. Reviewed By: mweststrate Differential Revision: D21906983 fbshipit-source-id: 5a9522a5ba3f504108282fb27deae25b5eadc693 --- desktop/plugins/databases/index.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/desktop/plugins/databases/index.tsx b/desktop/plugins/databases/index.tsx index 389a3315c..f5b44993b 100644 --- a/desktop/plugins/databases/index.tsx +++ b/desktop/plugins/databases/index.tsx @@ -98,7 +98,6 @@ type Page = { count: number; total: number; highlightedRows: Array; - editable: boolean; }; export type Structure = { @@ -500,10 +499,6 @@ export default class DatabasesPlugin extends FlipperPlugin< indexesColumns: event.indexesColumns, indexesValues: event.indexesValues, }, - currentPage: { - ...state.currentPage!, - editable: isUpdatable(event.columns, event.rows), - }, }; }, ], @@ -821,7 +816,6 @@ export default class DatabasesPlugin extends FlipperPlugin< count: data.count, total: data.total, highlightedRows: [], - editable: false, }); }) .catch((e) => { @@ -1137,7 +1131,15 @@ export default class DatabasesPlugin extends FlipperPlugin< )}