mirror of
				https://github.com/lingble/twenty.git
				synced 2025-10-31 04:37:56 +00:00 
			
		
		
		
	 0125d58ba8
			
		
	
	0125d58ba8
	
	
	
		
			
			closes - #5755 --------- Co-authored-by: martmull <martmull@hotmail.fr> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
		
			
				
	
	
		
			26 lines
		
	
	
		
			932 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			932 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { prefetchIsLoadedFamilyState } from '@/prefetch/states/prefetchIsLoadedFamilyState';
 | |
| import { PrefetchKey } from '@/prefetch/types/PrefetchKey';
 | |
| import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
 | |
| import { useRecoilValue } from 'recoil';
 | |
| import { useIsFavoriteFoldersPrefetchLoading } from './useIsFavoriteFoldersPrefetchLoading';
 | |
| 
 | |
| export const useIsPrefetchLoading = () => {
 | |
|   const isFavoriteFolderEnabled = useIsFeatureEnabled(
 | |
|     'IS_FAVORITE_FOLDER_ENABLED',
 | |
|   );
 | |
|   const isFavoriteFoldersLoading = useIsFavoriteFoldersPrefetchLoading();
 | |
| 
 | |
|   const areViewsPrefetched = useRecoilValue(
 | |
|     prefetchIsLoadedFamilyState(PrefetchKey.AllViews),
 | |
|   );
 | |
|   const areFavoritesPrefetched = useRecoilValue(
 | |
|     prefetchIsLoadedFamilyState(PrefetchKey.AllFavorites),
 | |
|   );
 | |
| 
 | |
|   return (
 | |
|     !areViewsPrefetched ||
 | |
|     !areFavoritesPrefetched ||
 | |
|     (isFavoriteFolderEnabled && isFavoriteFoldersLoading)
 | |
|   );
 | |
| };
 |