Files
twenty/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventDetailsEffect.tsx
Lucas Bordeau 0553f58c52 Removed use-context-selector completely (#12139)
This PR removes use-context-selector completely, so that any bug
associated with state synchronization between recoil and
use-context-selector disappears.

There might be a slight performance decrease on the table, but since we
have already improved the average performance per line by a lot, and
that the performance bottleneck right now is the fetch more logic and
the windowing solution we use, it is not relevant.

Also the DX has become so hindered by this parallel state logic recently
(think [cache
invalidation](https://martinfowler.com/bliki/TwoHardThings.html)), that
the main benefit we gain from this removal is the DX improvement.

Fixes https://github.com/twentyhq/twenty/issues/12123
Fixes https://github.com/twentyhq/twenty/issues/12109
2025-05-20 13:35:28 +02:00

24 lines
575 B
TypeScript

import { CalendarEvent } from '@/activities/calendar/types/CalendarEvent';
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
import { useEffect } from 'react';
type CalendarEventDetailsEffectProps = {
record: CalendarEvent;
};
export const CalendarEventDetailsEffect = ({
record,
}: CalendarEventDetailsEffectProps) => {
const { upsertRecords } = useUpsertRecordsInStore();
useEffect(() => {
if (!record) {
return;
}
upsertRecords([record]);
}, [record, upsertRecords]);
return <></>;
};