mirror of
				https://github.com/lingble/twenty.git
				synced 2025-10-31 12:47:58 +00:00 
			
		
		
		
	Fix create task (#7498)
Fixing issue introduced by [Add Skeleton loading for side panel](https://github.com/twentyhq/twenty/pull/7394/files#top): https://github.com/user-attachments/assets/6c8e299c-d663-4aa7-83ed-ca7041cd15e7
This commit is contained in:
		| @@ -67,8 +67,8 @@ export const useOpenCreateActivityDrawer = ({ | ||||
|     targetableObjects: ActivityTargetableObject[]; | ||||
|     customAssignee?: WorkspaceMember; | ||||
|   }) => { | ||||
|     openRightDrawer(RightDrawerPages.ViewRecord); | ||||
|     setIsNewViewableRecordLoading(true); | ||||
|     openRightDrawer(RightDrawerPages.ViewRecord); | ||||
|     setViewableRecordId(null); | ||||
|     setViewableRecordNameSingular(activityObjectNameSingular); | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| import { useRecoilValue } from 'recoil'; | ||||
|  | ||||
| import { isNewViewableRecordLoadingState } from '@/object-record/record-right-drawer/states/isNewViewableRecordLoading'; | ||||
| import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; | ||||
| import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState'; | ||||
| import { RecordShowContainer } from '@/object-record/record-show/components/RecordShowContainer'; | ||||
| @@ -18,7 +19,19 @@ export const RightDrawerRecord = () => { | ||||
|   const viewableRecordNameSingular = useRecoilValue( | ||||
|     viewableRecordNameSingularState, | ||||
|   ); | ||||
|   const isNewViewableRecordLoading = useRecoilValue( | ||||
|     isNewViewableRecordLoadingState, | ||||
|   ); | ||||
|   const viewableRecordId = useRecoilValue(viewableRecordIdState); | ||||
|  | ||||
|   if (!viewableRecordNameSingular && !isNewViewableRecordLoading) { | ||||
|     throw new Error(`Object name is not defined`); | ||||
|   } | ||||
|  | ||||
|   if (!viewableRecordId && !isNewViewableRecordLoading) { | ||||
|     throw new Error(`Record id is not defined`); | ||||
|   } | ||||
|  | ||||
|   const { objectNameSingular, objectRecordId } = useRecordShowPage( | ||||
|     viewableRecordNameSingular ?? '', | ||||
|     viewableRecordId ?? '', | ||||
| @@ -27,12 +40,15 @@ export const RightDrawerRecord = () => { | ||||
|   return ( | ||||
|     <StyledRightDrawerRecord> | ||||
|       <RecordFieldValueSelectorContextProvider> | ||||
|         {!isNewViewableRecordLoading && ( | ||||
|           <RecordValueSetterEffect recordId={objectRecordId} /> | ||||
|         )} | ||||
|         <RecordShowContainer | ||||
|           objectNameSingular={objectNameSingular} | ||||
|           objectRecordId={objectRecordId} | ||||
|           loading={false} | ||||
|           isInRightDrawer={true} | ||||
|           isNewRightDrawerItemLoading={isNewViewableRecordLoading} | ||||
|         /> | ||||
|       </RecordFieldValueSelectorContextProvider> | ||||
|     </StyledRightDrawerRecord> | ||||
|   | ||||
| @@ -21,7 +21,6 @@ import { RecordInlineCell } from '@/object-record/record-inline-cell/components/ | ||||
| import { PropertyBox } from '@/object-record/record-inline-cell/property-box/components/PropertyBox'; | ||||
| import { PropertyBoxSkeletonLoader } from '@/object-record/record-inline-cell/property-box/components/PropertyBoxSkeletonLoader'; | ||||
| import { InlineCellHotkeyScope } from '@/object-record/record-inline-cell/types/InlineCellHotkeyScope'; | ||||
| import { isNewViewableRecordLoadingState } from '@/object-record/record-right-drawer/states/isNewViewableRecordLoading'; | ||||
| import { RecordDetailDuplicatesSection } from '@/object-record/record-show/record-detail-section/components/RecordDetailDuplicatesSection'; | ||||
| import { RecordDetailRelationSection } from '@/object-record/record-show/record-detail-section/components/RecordDetailRelationSection'; | ||||
| import { recordLoadingFamilyState } from '@/object-record/record-store/states/recordLoadingFamilyState'; | ||||
| @@ -49,6 +48,7 @@ type RecordShowContainerProps = { | ||||
|   objectRecordId: string; | ||||
|   loading: boolean; | ||||
|   isInRightDrawer?: boolean; | ||||
|   isNewRightDrawerItemLoading?: boolean; | ||||
| }; | ||||
|  | ||||
| export const RecordShowContainer = ({ | ||||
| @@ -56,6 +56,7 @@ export const RecordShowContainer = ({ | ||||
|   objectRecordId, | ||||
|   loading, | ||||
|   isInRightDrawer = false, | ||||
|   isNewRightDrawerItemLoading = false, | ||||
| }: RecordShowContainerProps) => { | ||||
|   const { objectMetadataItem } = useObjectMetadataItem({ | ||||
|     objectNameSingular, | ||||
| @@ -82,9 +83,6 @@ export const RecordShowContainer = ({ | ||||
|       recordId: objectRecordId, | ||||
|     }), | ||||
|   ); | ||||
|   const isNewViewableRecordLoading = useRecoilValue( | ||||
|     isNewViewableRecordLoadingState, | ||||
|   ); | ||||
|   const [uploadImage] = useUploadImageMutation(); | ||||
|   const { updateOneRecord } = useUpdateOneRecord({ objectNameSingular }); | ||||
|  | ||||
| @@ -166,8 +164,6 @@ export const RecordShowContainer = ({ | ||||
|   const isReadOnly = objectMetadataItem.isRemote; | ||||
|   const isMobile = useIsMobile() || isInRightDrawer; | ||||
|   const isPrefetchLoading = useIsPrefetchLoading(); | ||||
|   const isNewRightDrawerItemLoading = | ||||
|     isInRightDrawer && isNewViewableRecordLoading; | ||||
|  | ||||
|   const summaryCard = | ||||
|     !isNewRightDrawerItemLoading && isDefined(recordFromStore) ? ( | ||||
|   | ||||
| @@ -23,10 +23,10 @@ export const useRecordShowPage = ( | ||||
|     objectRecordId: paramObjectRecordId, | ||||
|   } = useParams(); | ||||
|  | ||||
|   const objectNameSingular = propsObjectNameSingular || paramObjectNameSingular; | ||||
|   const objectRecordId = propsObjectRecordId || paramObjectRecordId; | ||||
|   const objectNameSingular = propsObjectNameSingular ?? paramObjectNameSingular; | ||||
|   const objectRecordId = propsObjectRecordId ?? paramObjectRecordId; | ||||
|  | ||||
|   if (!objectNameSingular || !objectRecordId) { | ||||
|   if (!isDefined(objectNameSingular) || !isDefined(objectRecordId)) { | ||||
|     throw new Error('Object name or Record id is not defined'); | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Marie
					Marie