002322c8e3
## Context View system used to rely on workspaceSchema views and was loaded in what we called the "prefetch". We have recently migrated views to core.coreViews and the states should now be named after coreViews Fixes: https://github.com/twentyhq/twenty/issues/14349
22 lines
692 B
TypeScript
22 lines
692 B
TypeScript
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
|
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
|
import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector';
|
|
|
|
import { useRecoilValue } from 'recoil';
|
|
|
|
export const useGetCurrentViewOnly = () => {
|
|
const currentViewId = useRecoilComponentValue(
|
|
contextStoreCurrentViewIdComponentState,
|
|
);
|
|
|
|
const currentView = useRecoilValue(
|
|
coreViewFromViewIdFamilySelector({
|
|
viewId: currentViewId ?? '',
|
|
}),
|
|
);
|
|
|
|
return {
|
|
currentView,
|
|
};
|
|
};
|