Files
twenty_crm/packages/twenty-front/src/modules/views/scopes/init-effect/ViewScopeInitEffect.tsx
T
Charles Bochet cfb0cce9b8 Refactor Views by cleaning the code, relying on apolloCache and improving performances (#4516)
* Wip refactoring view

* Post merge conflicts

* Fix review

* Add create view capability

* Fix create object missing view

* Fix tests
2024-03-20 14:21:58 +01:00

25 lines
728 B
TypeScript

import { useEffect } from 'react';
import { useSetRecoilState } from 'recoil';
import { useViewStates } from '@/views/hooks/internal/useViewStates';
import { GraphQLView } from '@/views/types/GraphQLView';
type ViewScopeInitEffectProps = {
viewScopeId: string;
onCurrentViewChange: (view: GraphQLView | undefined) => void | Promise<void>;
};
export const ViewScopeInitEffect = ({
onCurrentViewChange,
}: ViewScopeInitEffectProps) => {
const { onCurrentViewChangeState } = useViewStates();
const setOnCurrentViewChange = useSetRecoilState(onCurrentViewChangeState);
useEffect(() => {
setOnCurrentViewChange(() => onCurrentViewChange);
}, [onCurrentViewChange, setOnCurrentViewChange]);
return <></>;
};