Favorites should be user-level not workspace-level (#5186)

### Description
Favorites should be user-level not workspace-level

### Refs
#3374

### Demo


https://github.com/twentyhq/twenty/assets/140154534/38a34cc7-ac58-494f-92d5-e15c43ae542e

Fixes #3374

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
gitstart-twenty 2024-04-30 22:42:44 +08:00 committed by GitHub
parent bc0d30f28b
commit 9ad68ffe84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -37,6 +37,11 @@ export const useFavorites = () => {
const { records: favorites } = usePrefetchedData<Favorite>(
PrefetchKey.AllFavorites,
{
workspaceMemberId: {
eq: currentWorkspaceMember?.id ?? '',
},
},
);
const favoriteRelationFieldMetadataItems = useMemo(

View File

@ -1,6 +1,7 @@
import { useRecoilValue } from 'recoil';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { RecordGqlOperationFilter } from '@/object-record/graphql/types/RecordGqlOperationFilter';
import { generateDepthOneRecordGqlFields } from '@/object-record/graphql/utils/generateDepthOneRecordGqlFields';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
@ -10,6 +11,7 @@ import { PrefetchKey } from '@/prefetch/types/PrefetchKey';
export const usePrefetchedData = <T extends ObjectRecord>(
prefetchKey: PrefetchKey,
filter?: RecordGqlOperationFilter,
) => {
const isDataPrefetched = useRecoilValue(
prefetchIsLoadedFamilyState(prefetchKey),
@ -29,6 +31,7 @@ export const usePrefetchedData = <T extends ObjectRecord>(
generateDepthOneRecordGqlFields({
objectMetadataItem,
}),
filter,
});
return {