Skip to content

Commit 211ff08

Browse files
committed
fix(web): enhance useRefresh hook to fetch someday events for the current month
1 parent aea6d74 commit 211ff08

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/web/src/views/Calendar/hooks/useRefresh.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import dayjs from "dayjs";
12
import { useEffect } from "react";
23
import { toUTCOffset } from "@web/common/utils/web.date.util";
34
import { Sync_AsyncStateContextReason } from "@web/ducks/events/context/sync.context";
45
import { Week_AsyncStateContextReason } from "@web/ducks/events/context/week.context";
56
import { selectImportLatestState } from "@web/ducks/events/selectors/sync.selector";
67
import { selectDatesInView } from "@web/ducks/events/selectors/view.selectors";
8+
import { getSomedayEventsSlice } from "@web/ducks/events/slices/someday.slice";
79
import { resetIsFetchNeeded } from "@web/ducks/events/slices/sync.slice";
810
import { getWeekEventsSlice } from "@web/ducks/events/slices/week.slice";
911
import { useAppDispatch, useAppSelector } from "@web/store/store.hooks";
@@ -33,6 +35,19 @@ export const useRefresh = () => {
3335
},
3436
}),
3537
);
38+
39+
const startDate = dayjs(start).startOf("month").format();
40+
const endDate = dayjs(end).endOf("month").format();
41+
dispatch(
42+
getSomedayEventsSlice.actions.request({
43+
startDate,
44+
endDate,
45+
__context: {
46+
reason: getRefreshWeekEventsReason(),
47+
},
48+
}),
49+
);
50+
console.log("getWeekEventsSlice.actions.request");
3651
dispatch(resetIsFetchNeeded());
3752
}
3853
// eslint-disable-next-line react-hooks/exhaustive-deps

0 commit comments

Comments
 (0)