You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/10/04 15:28:32 UTC
[superset] 02/05: fix(dashboard): recursive parent on dashboard
components (#16933)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch 1.3
in repository https://gitbox.apache.org/repos/asf/superset.git
commit b04a9f8ca126c90cb9c38cdc5d93404d59d603dc
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Fri Oct 1 17:13:38 2021 +0200
fix(dashboard): recursive parent on dashboard components (#16933)
* fix(dashboard): don't add recursive parents on wrapper component
* add test
* refine logic and add new test
(cherry picked from commit a07c9d591b073203be042b5512c52fbb47184189)
---
.../spec/javascripts/dashboard/util/newEntitiesFromDrop_spec.js | 8 ++++++--
superset-frontend/src/dashboard/util/newEntitiesFromDrop.js | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/spec/javascripts/dashboard/util/newEntitiesFromDrop_spec.js b/superset-frontend/spec/javascripts/dashboard/util/newEntitiesFromDrop_spec.js
index 339ab1e..6ab8056 100644
--- a/superset-frontend/spec/javascripts/dashboard/util/newEntitiesFromDrop_spec.js
+++ b/superset-frontend/spec/javascripts/dashboard/util/newEntitiesFromDrop_spec.js
@@ -94,7 +94,11 @@ describe('newEntitiesFromDrop', () => {
expect(result.a.children).toHaveLength(1);
expect(Object.keys(result)).toHaveLength(3);
- expect(result[newRowId].type).toBe(ROW_TYPE);
- expect(result[newChartId].type).toBe(CHART_TYPE);
+ const newRow = result[newRowId];
+ expect(newRow.type).toBe(ROW_TYPE);
+ expect(newRow.parents).toEqual(['a']);
+ const newChart = result[newChartId];
+ expect(newChart.type).toBe(CHART_TYPE);
+ expect(newChart.parents).toEqual(['a', newRowId]);
});
});
diff --git a/superset-frontend/src/dashboard/util/newEntitiesFromDrop.js b/superset-frontend/src/dashboard/util/newEntitiesFromDrop.js
index c0e5157..3b3a914 100644
--- a/superset-frontend/src/dashboard/util/newEntitiesFromDrop.js
+++ b/superset-frontend/src/dashboard/util/newEntitiesFromDrop.js
@@ -51,8 +51,8 @@ export default function newEntitiesFromDrop({ dropResult, layout }) {
rowWrapper.children = [newDropChild.id];
rowWrapper.parents = (dropEntity.parents || []).concat(dropEntity.id);
newEntities[rowWrapper.id] = rowWrapper;
- newDropChild = rowWrapper;
newDropChild.parents = rowWrapper.parents.concat(rowWrapper.id);
+ newDropChild = rowWrapper;
} else if (dragType === TABS_TYPE) {
// create a new tab component
const tabChild = newComponentFactory(TAB_TYPE);