Skip to content
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 errors on pipelineRange with null start_ts and end_ts #1184

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions www/js/TimelineContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@

function loadDateRange(range: [string, string]) {
logDebug('Timeline: loadDateRange with newDateRange = ' + range);
if (!pipelineRange) {
logWarn('No pipelineRange yet - early return from loadDateRange');
if (!pipelineRange?.start_ts) {
logWarn('No pipelineRange start_ts yet - early return from loadDateRange');

Check warning on line 180 in www/js/TimelineContext.ts

View check run for this annotation

Codecov / codecov/patch

www/js/TimelineContext.ts#L180

Added line #L180 was not covered by tests
return;
}
const pipelineStartDate = DateTime.fromSeconds(pipelineRange.start_ts).toISODate();
Expand Down Expand Up @@ -220,8 +220,10 @@
}

async function fetchTripsInRange(dateRange: [string, string]) {
if (!pipelineRange?.start_ts || !pipelineRange?.end_ts)
return logWarn('No pipelineRange yet - early return');
if (!pipelineRange?.start_ts || !pipelineRange?.end_ts) {
logDebug('No pipelineRange yet, returning empty lists');
return [[], []];

Check warning on line 225 in www/js/TimelineContext.ts

View check run for this annotation

Codecov / codecov/patch

www/js/TimelineContext.ts#L224-L225

Added lines #L224 - L225 were not covered by tests
}
logDebug('Timeline: fetchTripsInRange from ' + dateRange[0] + ' to ' + dateRange[1]);

const [startTs, endTs] = isoDateRangeToTsRange(dateRange);
Expand Down
3 changes: 2 additions & 1 deletion www/js/diary/list/TimelineScrollList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const TimelineScrollList = ({ listEntries }: Props) => {
</LoadMoreButton>
);

const pipelineEndDate = pipelineRange && DateTime.fromSeconds(pipelineRange.end_ts).toISODate();
const pipelineEndDate =
pipelineRange?.end_ts && DateTime.fromSeconds(pipelineRange.end_ts).toISODate();
const noTravelBanner = (
<Banner visible={true} icon={({ size }) => <Icon source="alert-circle" size={size} />}>
<View style={{ width: '100%' }}>
Expand Down
Loading