Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
estermv committed Sep 15, 2021
1 parent 0eeaa78 commit 06f02c4
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export function useCharts() {
const { handleTimeChange } = useContext(MonitoringTimeContainer.Context);

const [zoomInLevel, setZoomInLevel] = useState(0);

// We need something to know when the onBrush event was fired because the pop state event
// is also fired when the onBrush event is fired (although only on the first onBrush event) and
// causing the zoomInLevel to change.
// In Angular, this was handled by removing the listener before updating the state and adding
// it again after some milliseconds, but the same trick didn't work in React.
const [onBrushHappened, _setOnBrushHappened] = useState(false);

const onBrushHappenedRef = useRef(onBrushHappened);
Expand Down

0 comments on commit 06f02c4

Please sign in to comment.