Skip to content

Commit 1f70821

Browse files
committed
fix performance and display issue related to thread size
1 parent 64d36a4 commit 1f70821

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

src/app/dfSlice.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export interface DataFormulatorState {
6262
focusedTableId: string | undefined;
6363
focusedChartId: string | undefined;
6464
activeThreadChartId: string | undefined; // specifying which chartThread is actively viewed
65-
threadDrawerOpen: boolean; // decides whether the thread drawer is open
6665

6766
chartSynthesisInProgress: string[];
6867

@@ -96,7 +95,6 @@ const initialState: DataFormulatorState = {
9695
focusedTableId: undefined,
9796
focusedChartId: undefined,
9897
activeThreadChartId: undefined,
99-
threadDrawerOpen: false,
10098

10199
chartSynthesisInProgress: [],
102100

@@ -246,7 +244,6 @@ export const dataFormulatorSlice = createSlice({
246244
state.focusedTableId = undefined;
247245
state.focusedChartId = undefined;
248246
state.activeThreadChartId = undefined;
249-
state.threadDrawerOpen = false;
250247

251248
state.chartSynthesisInProgress = [];
252249

@@ -274,7 +271,6 @@ export const dataFormulatorSlice = createSlice({
274271
state.focusedTableId = savedState.focusedTableId || undefined;
275272
state.focusedChartId = savedState.focusedChartId || undefined;
276273
state.activeThreadChartId = savedState.activeThreadChartId || undefined;
277-
state.threadDrawerOpen = false;
278274

279275
state.chartSynthesisInProgress = [];
280276

@@ -573,9 +569,6 @@ export const dataFormulatorSlice = createSlice({
573569
setVisPaneSize: (state, action: PayloadAction<number>) => {
574570
state.visPaneSize = action.payload;
575571
},
576-
setThreadDrawerOpen: (state, action: PayloadAction<boolean>) => {
577-
state.threadDrawerOpen = action.payload;
578-
},
579572
setDisplayPanelSize: (state, action: PayloadAction<number>) => {
580573
state.displayPanelSize = action.payload;
581574
},

src/views/DataThread.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,22 +299,20 @@ export const DataThread: FC<{}> = function ({ }) {
299299
let tables = useSelector((state: DataFormulatorState) => state.tables);
300300
let charts = useSelector((state: DataFormulatorState) => state.charts);
301301
let focusedChartId = useSelector((state: DataFormulatorState) => state.focusedChartId);
302-
let threadDrawerOpen = useSelector((state: DataFormulatorState) => state.threadDrawerOpen);
303302

304303
let chartSynthesisInProgress = useSelector((state: DataFormulatorState) => state.chartSynthesisInProgress);
305304

306305
const conceptShelfItems = useSelector((state: DataFormulatorState) => state.conceptShelfItems);
307306

307+
let [threadDrawerOpen, setThreadDrawerOpen] = useState<boolean>(false);
308+
308309
const scrollRef = useRef<null | HTMLDivElement>(null)
309310

310311
const executeScroll = () => { if (scrollRef.current != null) scrollRef.current.scrollIntoView() }
311312
// run this function from an event handler or an effect to execute scroll
312313

313-
314314
const dispatch = useDispatch();
315315

316-
let setThreadDrawerOpen = (flag: boolean) => { dispatch(dfActions.setThreadDrawerOpen(flag)); }
317-
318316
useEffect(() => {
319317
executeScroll();
320318
}, [threadDrawerOpen])
@@ -467,7 +465,7 @@ export const DataThread: FC<{}> = function ({ }) {
467465

468466
let drawerOpen = leafTables.length > 1 && threadDrawerOpen;
469467

470-
let view = <Box sx={{ margin: "0px 0px 8px 0px", display: 'flex', flexDirection: drawerOpen ? 'row-reverse' : 'column', paddingBottom: 2 }}>
468+
let view = <Box sx={{ width: '100%', margin: "0px 0px 8px 0px", display: 'flex', flexDirection: drawerOpen ? 'row-reverse' : 'column', paddingBottom: 2 }}>
471469
{leafTables.map((lt, i) => {
472470
let usedTableIds = leafTables.slice(0, i)
473471
.map(x => [x.id, ...getTriggers(x, tables).map(y => y.tableId) || []]).flat();

src/views/VisualizationView.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ export const ChartEditorFC: FC<{ cachedCandidates: DictTable[],
242242
let charts = useSelector((state: DataFormulatorState) => state.charts);
243243
let focusedChartId = useSelector((state: DataFormulatorState) => state.focusedChartId);
244244
let chartSynthesisInProgress = useSelector((state: DataFormulatorState) => state.chartSynthesisInProgress);
245-
let threadDrawerOpen = useSelector((state: DataFormulatorState) => state.threadDrawerOpen);
246245

247246
let synthesisRunning = focusedChartId ? chartSynthesisInProgress.includes(focusedChartId) : false;
248247
let handleDeleteChart = () => { focusedChartId && dispatch(dfActions.deleteChartById(focusedChartId)) }
@@ -271,13 +270,6 @@ export const ChartEditorFC: FC<{ cachedCandidates: DictTable[],
271270
setFocusUpdated(true);
272271
}, [focusedChartId])
273272

274-
useEffect(() => {
275-
let width = componentRef.current ? componentRef.current.offsetWidth : 0
276-
if (width < 640 && threadDrawerOpen == true) {
277-
setCollapseEditor(threadDrawerOpen);
278-
}
279-
}, [threadDrawerOpen])
280-
281273
let chartUnavailable = true;
282274

283275
let table = getDataTable(focusedChart, tables, charts, conceptShelfItems);

0 commit comments

Comments
 (0)