mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
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
This commit is contained in:
parent
90f711f45c
commit
a07c9d591b
@ -94,7 +94,11 @@ describe('newEntitiesFromDrop', () => {
|
|||||||
|
|
||||||
expect(result.a.children).toHaveLength(1);
|
expect(result.a.children).toHaveLength(1);
|
||||||
expect(Object.keys(result)).toHaveLength(3);
|
expect(Object.keys(result)).toHaveLength(3);
|
||||||
expect(result[newRowId].type).toBe(ROW_TYPE);
|
const newRow = result[newRowId];
|
||||||
expect(result[newChartId].type).toBe(CHART_TYPE);
|
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]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -51,8 +51,8 @@ export default function newEntitiesFromDrop({ dropResult, layout }) {
|
|||||||
rowWrapper.children = [newDropChild.id];
|
rowWrapper.children = [newDropChild.id];
|
||||||
rowWrapper.parents = (dropEntity.parents || []).concat(dropEntity.id);
|
rowWrapper.parents = (dropEntity.parents || []).concat(dropEntity.id);
|
||||||
newEntities[rowWrapper.id] = rowWrapper;
|
newEntities[rowWrapper.id] = rowWrapper;
|
||||||
newDropChild = rowWrapper;
|
|
||||||
newDropChild.parents = rowWrapper.parents.concat(rowWrapper.id);
|
newDropChild.parents = rowWrapper.parents.concat(rowWrapper.id);
|
||||||
|
newDropChild = rowWrapper;
|
||||||
} else if (dragType === TABS_TYPE) {
|
} else if (dragType === TABS_TYPE) {
|
||||||
// create a new tab component
|
// create a new tab component
|
||||||
const tabChild = newComponentFactory(TAB_TYPE);
|
const tabChild = newComponentFactory(TAB_TYPE);
|
||||||
|
Loading…
Reference in New Issue
Block a user