Skip to content

Commit

Permalink
fix: soft deleted records are read only
Browse files Browse the repository at this point in the history
  • Loading branch information
pau-not-paul committed Oct 30, 2024
1 parent 8ef4efa commit a2d53b3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export const FieldsCard = ({
objectNameSingular !== CoreObjectNameSingular.Task &&
fieldMetadataItem.name !== 'taskTargets',
);
const isReadOnly = objectMetadataItem.isRemote;
const isReadOnly =
objectMetadataItem.isRemote || !!recordFromStore?.deletedAt;

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const SummaryCard = ({

const { Icon, IconColor } = useGetStandardObjectIcon(objectNameSingular);
const isMobile = useIsMobile() || isInRightDrawer;
const isReadOnly = objectMetadataItem.isRemote;
const isReadOnly =
objectMetadataItem.isRemote || !!recordFromStore?.deletedAt;

if (isNewRightDrawerItemLoading || !isDefined(recordFromStore)) {
return <ShowPageSummaryCardSkeletonLoader />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { useTheme } from '@emotion/react';
import { Draggable } from '@hello-pangea/dnd';
import { ReactNode, useContext, useEffect } from 'react';
import { useInView } from 'react-intersection-observer';
import { useRecoilValue } from 'recoil';
import { useRecoilState, useRecoilValue } from 'recoil';

import { getBasePathToShowPage } from '@/object-metadata/utils/getBasePathToShowPage';
import { RecordIndexRootPropsContext } from '@/object-record/record-index/contexts/RecordIndexRootPropsContext';
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
import { RecordTableContext } from '@/object-record/record-table/contexts/RecordTableContext';
import { RecordTableRowContext } from '@/object-record/record-table/contexts/RecordTableRowContext';
import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates';
Expand Down Expand Up @@ -35,6 +36,10 @@ export const RecordTableRowWrapper = ({
RecordTableWithWrappersScrollWrapperContext,
);

const [recordFromStore] = useRecoilState<any>(
recordStoreFamilyState(recordId)
);

const { ref: elementRef, inView } = useInView({
root: scrollWrapperRef.ref.current?.querySelector(
'[data-overlayscrollbars-viewport]',
Expand Down Expand Up @@ -82,7 +87,8 @@ export const RecordTableRowWrapper = ({
}) + recordId,
objectNameSingular: objectMetadataItem.nameSingular,
isSelected: currentRowSelected,
isReadOnly: objectMetadataItem.isRemote ?? false,
isReadOnly:
objectMetadataItem.isRemote || !!recordFromStore?.deletedAt,
isPendingRow,
isDragging: draggableSnapshot.isDragging,
dragHandleProps: draggableProvided.dragHandleProps,
Expand Down

0 comments on commit a2d53b3

Please sign in to comment.