favorite folders followup (#8570)

Something changed, which affected the Favorite folder picker checkbox
styles -- fixed it!
Cleaned up code in `CurrentWorkspaceMemberFavoritesFolders` - removed
redundant filtering since favorites are already filtered in
`usePrefetchedFavoritesData`.
Regarding issue #8569 - I am not sure what to do in this case. Since
Folders data is gated by a feature flag, we can't use it in
`CurrentWorkspaceMemberFavoritesFolders` to ensure the favorite section
renders with empty folders. Currently, the section only appears when at
least one favorite exists - may be leave this section open at all times
or fix this bug after removal of the feature flag?

---------

Co-authored-by: Nitin Koche <nitinkoche@Nitins-MacBook-Pro.local>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
nitin
2024-11-19 23:25:25 +05:30
committed by GitHub
parent 2773974459
commit 4f2019edae
45 changed files with 253 additions and 315 deletions

View File

@ -9,14 +9,10 @@ import { PREFETCH_CONFIG } from '@/prefetch/constants/PrefetchConfig';
import { usePrefetchRunQuery } from '@/prefetch/hooks/internal/usePrefetchRunQuery';
import { PrefetchKey } from '@/prefetch/types/PrefetchKey';
import { View } from '@/views/types/View';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { isDefined } from '~/utils/isDefined';
export const PrefetchRunQueriesEffect = () => {
const currentUser = useRecoilValue(currentUserState);
const isFavoriteFolderEnabled = useIsFeatureEnabled(
'IS_FAVORITE_FOLDER_ENABLED',
);
const { upsertRecordsInCache: upsertViewsInCache } =
usePrefetchRunQuery<View>({
@ -33,7 +29,7 @@ export const PrefetchRunQueriesEffect = () => {
const operationSignatures = Object.values(PREFETCH_CONFIG)
.filter(
({ objectNameSingular }) =>
// Exclude favorite folders as they're handled separately
// TODO: Remove this filter once we merge PrefetchFavortiteFoldersRunQueriesEffect with this component
objectNameSingular !== 'favoriteFolder',
)
.map(({ objectNameSingular, operationSignatureFactory }) => {
@ -57,12 +53,7 @@ export const PrefetchRunQueriesEffect = () => {
if (isDefined(result.favorites)) {
upsertFavoritesInCache(result.favorites as Favorite[]);
}
}, [
result,
upsertViewsInCache,
upsertFavoritesInCache,
isFavoriteFolderEnabled,
]);
}, [result, upsertViewsInCache, upsertFavoritesInCache]);
return <></>;
};