da5ecf35fa
### Summary This PR removes an unused `view` import from **framer-motion** in `useUpdateView.ts`. --- ### Context - The unused import was introduced in the recent commit to `main`. - It causes ESLint to fail, which blocks all new PRs from passing CI. ### Changes - Removed unused `view` import from `framer-motion`. ### Impact - Lint and CI should now pass again. - No runtime behavior is affected.
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
|
|
import { useRefreshCoreViewsByObjectMetadataId } from '@/views/hooks/useRefreshCoreViewsByObjectMetadataId';
|
|
import { type GraphQLView } from '@/views/types/GraphQLView';
|
|
import { convertUpdateViewInputToCore } from '@/views/utils/convertUpdateViewInputToCore';
|
|
import { useRecoilCallback } from 'recoil';
|
|
import { isDefined } from 'twenty-shared/utils';
|
|
import { useUpdateCoreViewMutation } from '~/generated/graphql';
|
|
|
|
export const useUpdateView = () => {
|
|
const [updateOneCoreView] = useUpdateCoreViewMutation();
|
|
|
|
const { refreshCoreViewsByObjectMetadataId } =
|
|
useRefreshCoreViewsByObjectMetadataId();
|
|
|
|
const { objectMetadataItem } = useRecordIndexContextOrThrow();
|
|
|
|
const updateView = useRecoilCallback(
|
|
() => async (view: Partial<GraphQLView>) => {
|
|
if (!isDefined(view.id)) {
|
|
return;
|
|
}
|
|
|
|
await updateOneCoreView({
|
|
variables: {
|
|
id: view.id,
|
|
input: convertUpdateViewInputToCore(view),
|
|
},
|
|
});
|
|
|
|
await refreshCoreViewsByObjectMetadataId(objectMetadataItem.id);
|
|
},
|
|
[
|
|
objectMetadataItem.id,
|
|
refreshCoreViewsByObjectMetadataId,
|
|
updateOneCoreView,
|
|
],
|
|
);
|
|
|
|
return {
|
|
updateView,
|
|
};
|
|
};
|