Skip to content

Commit

Permalink
Merge branch 'fix-null-pipelinerange' of https://github.com/JGreenlee…
Browse files Browse the repository at this point in the history
…/e-mission-phone into fix-timeline-refresh
  • Loading branch information
JGreenlee committed Oct 8, 2024
2 parents a437302 + 667a726 commit 944abe8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions www/js/TimelineContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ export const useTimelineContext = (): ContextProps => {

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');
return;
}
const pipelineStartDate = DateTime.fromSeconds(pipelineRange.start_ts).toISODate();
Expand Down Expand Up @@ -223,8 +223,10 @@ export const useTimelineContext = (): ContextProps => {
}

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 [[], []];
}
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

0 comments on commit 944abe8

Please sign in to comment.