added suspense for home page
This commit is contained in:
@@ -18,8 +18,8 @@ const getNextYearMonth = (yearMonth:YearMonth) => {
|
||||
}
|
||||
|
||||
export interface MonthLocationListProps {
|
||||
availableYears: number[];
|
||||
months: {
|
||||
availableYears?: number[];
|
||||
months?: {
|
||||
[key: string]: {
|
||||
yearMonth: YearMonth;
|
||||
locations: BillingLocation[];
|
||||
@@ -36,6 +36,20 @@ export const MonthLocationList:React.FC<MonthLocationListProps > = ({
|
||||
const router = useRouter();
|
||||
const params = useParams();
|
||||
|
||||
if(!availableYears || !months) {
|
||||
const currentYearMonth:YearMonth = {
|
||||
year: new Date().getFullYear(),
|
||||
month: new Date().getMonth() + 1
|
||||
};
|
||||
|
||||
return(
|
||||
<>
|
||||
<MonthCard yearMonth={currentYearMonth} key={`month-${currentYearMonth}`} monthlyExpense={0} onToggle={() => {}}>
|
||||
<AddLocationButton yearMonth={currentYearMonth} />
|
||||
</MonthCard>
|
||||
</>)
|
||||
};
|
||||
|
||||
const { month: initialMonth } = params;
|
||||
|
||||
const [expandedMonth, setExpandedMonth] = React.useState<number>(
|
||||
|
||||
Reference in New Issue
Block a user