-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #150: dateRangeChange incorrectly called #155
Conversation
Don't forget to squash all the commits into 1! :D |
packages/synchro-charts/src/components/charts/sc-webgl-base-chart/sc-webgl-base-chart.tsx
Show resolved
Hide resolved
packages/synchro-charts/src/components/charts/sc-webgl-base-chart/sc-webgl-base-chart.tsx
Show resolved
Hide resolved
packages/synchro-charts/src/components/charts/sc-webgl-base-chart/utils.ts
Outdated
Show resolved
Hide resolved
block event emission when viewport changes due to a live mode update fix linting issues add rest property types to updateViewPort fix #150 dateRangeChange called in live mode
b1e47a3
to
797b043
Compare
manager.updateViewPort({ start: newStart, end: newEnd, duration }); | ||
|
||
// Have manager update its own viewport, preventing 'dateRangeChange' events when in live mode | ||
const isInLiveMode = Boolean(duration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just say duration != duration
(a common pattern in this code base) rather than relying on the fact that Boolean(undefined) === 0
Another thought: what does duration: 0
imply? Would it possibly make sense to be in live mode, but only for a single instance in time? With this logic, it would detect as not being in live mode
jest.advanceTimersByTime(secondsElapsed * SECOND_IN_MS); | ||
expect(manager.updateViewPort).toBeCalledWith( | ||
expect.objectContaining({ | ||
shouldBlockDateRangeChangedEvent: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the situation where it shouldn't be blocked?
add flag for blocking dateRangeChanged event when in live mode block event emission when viewport changes due to a live mode update fix linting issues add rest property types to updateViewPort Co-authored-by: Thomas Juranek <thjurane@amazon.com>
Overview
Fixes #150.
When in live mode, the viewportHandler tick cycle was passing the updated viewport back to the rendered chart. The logic was set to emit the
dateRangeChange
event any time the viewport changed. When in live mode this isn't the desired behavior so a flag was added to be able to check for that and block the event from being emitted.Tests
[Include a link to the passing GitHub action running the test suite here.]
Legal
This project is available under the Apache 2.0 License.