Skip to content

Commit a29ccff

Browse files
committed
🐛 fix(someday-view): extend fetch someday events duration to end of month
1 parent 57fe8bd commit a29ccff

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

packages/web/src/ducks/events/sagas/someday.sagas.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
_assembleGridEvent,
1616
_createOptimisticGridEvent,
1717
_editEvent,
18+
getEventById,
1819
normalizedEventsSchema,
1920
replaceOptimisticId,
2021
} from "@web/ducks/events/sagas/saga.util";
@@ -55,14 +56,24 @@ export function* convertSomedayToCalendarEvent({
5556
}
5657

5758
export function* deleteSomedayEvent({ payload }: Action_DeleteEvent) {
59+
const event = yield* getEventById(payload._id);
60+
5861
try {
5962
yield put(eventsEntitiesSlice.actions.delete(payload));
6063

6164
yield call(EventApi.delete, payload._id, payload.applyTo);
6265
} catch (error) {
63-
yield put(getSomedayEventsSlice.actions.error());
66+
yield put(
67+
getSomedayEventsSlice.actions.error({
68+
__context: { reason: (error as Error).message },
69+
}),
70+
);
6471
handleError(error as Error);
65-
yield put(getSomedayEventsSlice.actions.request());
72+
yield put(
73+
eventsEntitiesSlice.actions.insert({
74+
[payload._id]: event as Schema_Event,
75+
}),
76+
);
6677
}
6778
}
6879

@@ -92,17 +103,24 @@ export function* getSomedayEvents({ payload }: Action_GetEvents) {
92103
offset: res.offset,
93104
}),
94105
);
95-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
96106
} catch (error) {
97-
yield put(getSomedayEventsSlice.actions.error());
107+
yield put(
108+
getSomedayEventsSlice.actions.error({
109+
__context: { reason: (error as Error).message },
110+
}),
111+
);
98112
}
99113
}
100114

101115
export function* reorderSomedayEvents({ payload }: Action_Someday_Reorder) {
102116
try {
103117
yield call(EventApi.reorder, payload);
104118
} catch (error) {
105-
yield put(getSomedayEventsSlice.actions.error());
119+
yield put(
120+
getSomedayEventsSlice.actions.error({
121+
__context: { reason: (error as Error).message },
122+
}),
123+
);
106124
handleError(error as Error);
107125
}
108126
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ export const useRefresh = () => {
4141
break;
4242
}
4343
case Sync_AsyncStateContextReason.SOCKET_SOMEDAY_EVENT_CHANGED: {
44+
const dateStart = dayjs(start);
4445
const { startDate, endDate } = computeSomedayEventsRequestFilter(
45-
dayjs(start),
46-
dayjs(end),
46+
dateStart,
47+
dateStart.endOf("month"),
4748
);
4849

4950
dispatch(

0 commit comments

Comments
 (0)