Skip to content

Commit e1d9d7f

Browse files
committed
performance improvement and fixes, also able to rename tables for better reference
1 parent 524027e commit e1d9d7f

File tree

8 files changed

+266
-193
lines changed

8 files changed

+266
-193
lines changed

src/app/dfSlice.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,11 @@ let deleteChartsRoutine = (state: DataFormulatorState, chartIds: string[]) => {
142142
state.activeThreadChartId = activeThreadChartId;
143143

144144
let unrefedDerivedTableIds = getUnrefedDerivedTableIds(state);
145-
state.tables = state.tables.filter(t => !unrefedDerivedTableIds.includes(t.id));
145+
let tableIdsToDelete = state.tables.filter(t => !t.anchored && unrefedDerivedTableIds.includes(t.id)).map(t => t.id);
146+
147+
state.tables = state.tables.filter(t => !tableIdsToDelete.includes(t.id));
146148
// remove intermediate charts that lead to this table
147-
state.charts = state.charts.filter(c => !(c.intermediate && unrefedDerivedTableIds.includes(c.intermediate.resultTableId)));
149+
state.charts = state.charts.filter(c => !(c.intermediate && tableIdsToDelete.includes(c.intermediate.resultTableId)));
148150
}
149151

150152
export const fetchFieldSemanticType = createAsyncThunk(
@@ -381,18 +383,6 @@ export const dataFormulatorSlice = createSlice({
381383
}
382384
})
383385
},
384-
updateChartScaleFactor: (state, action: PayloadAction<{chartId: string, scaleFactor: number}>) => {
385-
let chartId = action.payload.chartId;
386-
let scaleFactor = action.payload.scaleFactor;
387-
388-
state.charts = state.charts.map(chart => {
389-
if (chart.id == chartId) {
390-
return { ...chart, scaleFactor: scaleFactor };
391-
} else {
392-
return chart;
393-
}
394-
})
395-
},
396386
deleteChartById: (state, action: PayloadAction<string>) => {
397387
let chartId = action.payload;
398388
deleteChartsRoutine(state, [chartId]);

src/components/ComponentType.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ export type Chart = {
100100
encodingMap: EncodingMap,
101101
tableRef: string,
102102
saved: boolean,
103-
scaleFactor?: number,
104103
intermediate?: Trigger // whether this chart is only an intermediate chart (e.g., only used as a spec for transforming tables)
105104
}
106105

src/scss/VisualizationView.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,6 @@ $accelerate-ease: cubic-bezier(0.4, 0.0, 1, 1);
152152
animation: appear 0.5s ease-out;
153153
}
154154

155-
.focused-vega-thumbnail {
156-
//background-color: blue;
157-
box-shadow: 0 0 5px rgba(33,33,33,.3);
158-
z-index: 1;
159-
}
160-
161155
.vega-thumbnail:hover {
162156
transform: translateY(1px);
163157
box-shadow: 0 0 3px rgba(33,33,33,.2);

src/views/ConceptShelf.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ export interface ConceptShelfProps {
4646
export const ConceptGroup: FC<{groupName: string, fields: FieldItem[]}> = function ConceptGroup({groupName, fields}) {
4747

4848
const focusedTableId = useSelector((state: DataFormulatorState) => state.focusedTableId);
49+
const tables = useSelector((state: DataFormulatorState) => state.tables);
4950
const [expanded, setExpanded] = useState(false);
5051

5152
useEffect(() => {
52-
if (focusedTableId == groupName) {
53+
let focusedTable = tables.find(t => t.id == focusedTableId);
54+
if (focusedTableId == groupName || focusedTable?.derive?.source.includes(groupName)) {
5355
setExpanded(true);
5456
} else if (focusedTableId != groupName && groupName != "new fields") {
5557
setExpanded(false);

0 commit comments

Comments
 (0)