Skip to content

Commit

Permalink
Fix #3251 initial range setup to load data, Fix #3284 collapsed timel…
Browse files Browse the repository at this point in the history
…ine on startup (#3301)
  • Loading branch information
baloola authored and offtherailz committed Oct 30, 2018
1 parent ac60a9a commit c5f670f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions web/client/epics/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ const toISOString = date => isString(date) ? date : date.toISOString();
* @returns a stream of data with histogram and/or domain values
*/
const loadRangeData = (id, timeData, getState) => {
const {range, resolution} = roundRangeResolution( rangeSelector(getState()), MAX_HISTOGRAM);
/**
* when there is no timeline state rangeSelector(getState()) returns undefiend, so instead we use the timeData[id] range
*/
const dataRange = timeData.domain.split('--');

const initialRange = rangeSelector(getState()) || {start: new Date(dataRange[0]), end: new Date(dataRange[1])};

const {range, resolution} = roundRangeResolution( initialRange, MAX_HISTOGRAM);
const layerName = getLayerFromId(getState(), id).name;
const filter = {
[TIME_DIMENSION]: `${toISOString(range.start)}/${toISOString(range.end)}`
Expand Down Expand Up @@ -163,10 +170,6 @@ module.exports = {
action$.ofType(RANGE_CHANGED, UPDATE_LAYER_DIMENSION_DATA)
.debounceTime(500)
.switchMap( () => {
// if timeline is not present, don't update range data
if ( !rangeSelector(getState()) ) {
return Rx.Observable.empty();
}
const timeData = timeDataSelector(getState()) || {};
const layerIds = Object.keys(timeData).filter(id => timeData[id] && timeData[id].domain && isTimeDomainInterval(timeData[id].domain));
// update range data for every layer that need to sync with histogram/domain
Expand Down
2 changes: 1 addition & 1 deletion web/client/plugins/Timeline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const TimelinePlugin = compose(
setPlaybackRange: selectPlaybackRange
}),
branch(({ layers = [] }) => Object.keys(layers).length === 0, renderNothing),
withState('options', 'setOptions', {})
withState('options', 'setOptions', {collapsed: true})
)(
({
selectedLayer,
Expand Down

0 comments on commit c5f670f

Please sign in to comment.