Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
fix(detail): fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
dmorenogogoleva committed Jun 20, 2020
1 parent 81d15bd commit b5071a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shared/helpers/displayMoney.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const defaultParams = {
};

export const displayMoney = (currency: Currency) => (
amount: number | string | undefined | {},
amount: number | string | undefined,
params: Params = defaultParams,
) => {
const actualParams = {
Expand Down
6 changes: 5 additions & 1 deletion src/features/statistics/features/details/generic/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export const Detail = ({ group, detailType, detailTitle, dataPath }: Props) => {
const total = useMemo(() => {
if (!dataByPeriod) return Option.of(null);

return Option.of(head(dataByPeriod) && head(dataByPeriod)[dataPath]);
const lastPeriod = Option.of(head(dataByPeriod));

if (!lastPeriod) return Option.of(null);

return lastPeriod[dataPath];
}, [dataByPeriod]);

const errorState = error ? Option.of('Error') : Option.of<string>(null);
Expand Down

0 comments on commit b5071a0

Please sign in to comment.