Skip to content

Commit a0cc9e4

Browse files
committed
Debugged Sidebar
1 parent 5777c2f commit a0cc9e4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/app/containers/ActionContainer.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import SwitchAppDropdown from '../components/SwitchApp';
66

77
import { emptySnapshots, changeView, changeSlider } from '../actions/actions';
88
import { useStoreContext } from '../store';
9+
import { useEffect } from 'react';
910

1011
const resetSlider = () => {
1112
const slider = document.querySelector('.rc-slider-handle');
@@ -17,7 +18,7 @@ const resetSlider = () => {
1718
function ActionContainer(props) {
1819
const [{ tabs, currentTab }, dispatch] = useStoreContext();
1920
const { hierarchy, sliderIndex, viewIndex } = tabs[currentTab];
20-
const { toggleActionContainer, actionView } = props;
21+
const { toggleActionContainer, actionView, setActionView } = props;
2122
let actionsArr = [];
2223
const hierarchyArr: any[] = [];
2324

@@ -112,11 +113,14 @@ function ActionContainer(props) {
112113
);
113114
}
114115
);
116+
useEffect(() => {
117+
setActionView(true);
118+
}, []);
115119

116120
// this is not logging; the prop is not being udpdated or the component is not being re-rendered.
117121
return (
118122
<div id='action-id' className='action-container'>
119-
<div id = "arrow">
123+
<div id='arrow'>
120124
<aside className='aside'>
121125
<a onClick={toggleActionContainer} className='toggle'>
122126
<i></i>

src/app/containers/MainContainer.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ function MainContainer(): any {
2525
const [actionView, setActionView] = useState(true);
2626
//this function handles Time Jump sidebar view
2727
const toggleActionContainer = () => {
28+
setActionView(!actionView);
2829
const toggleElem = document.querySelector('aside');
2930
toggleElem.classList.toggle('no-aside');
30-
setActionView(!actionView);
3131
};
32+
useEffect(() => {
33+
setActionView(true);
34+
}, []);
3235

3336
useEffect(() => {
3437
// only open port once
@@ -115,7 +118,6 @@ function MainContainer(): any {
115118
});
116119
}
117120
}
118-
119121
document.addEventListener('click', mpClickTrack);
120122
}, []);
121123

@@ -191,6 +193,7 @@ function MainContainer(): any {
191193
<div id='bodyContainer' className='body-container1'>
192194
<ActionContainer
193195
actionView={actionView}
196+
setActionView={setActionView}
194197
toggleActionContainer={toggleActionContainer}
195198
/>
196199
{snapshots.length ? (

0 commit comments

Comments
 (0)