mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-27 06:13:16 +03:00
Fix infinite loop on sign in
This commit is contained in:
parent
e89546466c
commit
d4613c87f6
@ -37,5 +37,6 @@ export const useOpenCreateActivityDrawerForSelectedRowIds = () => {
|
|||||||
targetableEntities: activityTargetableEntityArray,
|
targetableEntities: activityTargetableEntityArray,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
[openCreateActivityDrawer],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,16 +1,19 @@
|
|||||||
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||||
import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural';
|
import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural';
|
||||||
import { turnFiltersIntoWhereClause } from '@/object-record/object-filter-dropdown/utils/turnFiltersIntoWhereClause';
|
import { turnFiltersIntoWhereClause } from '@/object-record/object-filter-dropdown/utils/turnFiltersIntoWhereClause';
|
||||||
import { turnSortsIntoOrderBy } from '@/object-record/object-sort-dropdown/utils/turnSortsIntoOrderBy';
|
import { turnSortsIntoOrderBy } from '@/object-record/object-sort-dropdown/utils/turnSortsIntoOrderBy';
|
||||||
import { useRecordTableScopedStates } from '@/object-record/record-table/hooks/internal/useRecordTableScopedStates';
|
import { useRecordTableScopedStates } from '@/object-record/record-table/hooks/internal/useRecordTableScopedStates';
|
||||||
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
|
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
|
||||||
|
import { signInBackgroundMockCompanies } from '@/sign-in-background-mock/constants/signInBackgroundMockCompanies';
|
||||||
|
|
||||||
import { useFindManyRecords } from './useFindManyRecords';
|
import { useFindManyRecords } from './useFindManyRecords';
|
||||||
|
|
||||||
export const useObjectRecordTable = () => {
|
export const useObjectRecordTable = () => {
|
||||||
const { scopeId: objectNamePlural, setRecordTableData } = useRecordTable();
|
const { scopeId: objectNamePlural, setRecordTableData } = useRecordTable();
|
||||||
|
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||||
|
|
||||||
const { objectNameSingular } = useObjectNameSingularFromPlural({
|
const { objectNameSingular } = useObjectNameSingularFromPlural({
|
||||||
objectNamePlural,
|
objectNamePlural,
|
||||||
@ -48,7 +51,7 @@ export const useObjectRecordTable = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
records,
|
records: currentWorkspace ? records : signInBackgroundMockCompanies,
|
||||||
loading,
|
loading,
|
||||||
fetchMoreRecords,
|
fetchMoreRecords,
|
||||||
queryStateIdentifier,
|
queryStateIdentifier,
|
||||||
|
@ -68,7 +68,9 @@ export const useRecordTableContextMenuEntries = (
|
|||||||
objectNameSingular,
|
objectNameSingular,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleDeleteClick = useRecoilCallback(({ snapshot }) => async () => {
|
const handleDeleteClick = useRecoilCallback(
|
||||||
|
({ snapshot }) =>
|
||||||
|
async () => {
|
||||||
const rowIdsToDelete = snapshot
|
const rowIdsToDelete = snapshot
|
||||||
.getLoadable(selectedRowIdsSelector)
|
.getLoadable(selectedRowIdsSelector)
|
||||||
.getValue();
|
.getValue();
|
||||||
@ -79,7 +81,9 @@ export const useRecordTableContextMenuEntries = (
|
|||||||
await deleteOneRecord(rowId);
|
await deleteOneRecord(rowId);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
[deleteOneRecord, resetTableRowSelection],
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
setContextMenuEntries: useCallback(() => {
|
setContextMenuEntries: useCallback(() => {
|
||||||
|
@ -20,7 +20,7 @@ export const RecordTableBody = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{tableRowIds.slice().map((rowId, rowIndex) => (
|
{tableRowIds.map((rowId, rowIndex) => (
|
||||||
<RowIdContext.Provider value={rowId} key={rowId}>
|
<RowIdContext.Provider value={rowId} key={rowId}>
|
||||||
<RowIndexContext.Provider value={rowIndex}>
|
<RowIndexContext.Provider value={rowIndex}>
|
||||||
<RecordTableRow key={rowId} rowId={rowId} />
|
<RecordTableRow key={rowId} rowId={rowId} />
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import { useRecoilCallback } from 'recoil';
|
import { useRecoilCallback } from 'recoil';
|
||||||
|
|
||||||
import { entityFieldsFamilyState } from '@/object-record/field/states/entityFieldsFamilyState';
|
import { entityFieldsFamilyState } from '@/object-record/field/states/entityFieldsFamilyState';
|
||||||
|
import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection';
|
||||||
|
import { isFetchingRecordTableDataState } from '@/object-record/record-table/states/isFetchingRecordTableDataState';
|
||||||
|
import { numberOfTableRowsState } from '@/object-record/record-table/states/numberOfTableRowsState';
|
||||||
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||||
|
|
||||||
import { isFetchingRecordTableDataState } from '../../states/isFetchingRecordTableDataState';
|
|
||||||
import { numberOfTableRowsState } from '../../states/numberOfTableRowsState';
|
|
||||||
import { tableRowIdsState } from '../../states/tableRowIdsState';
|
import { tableRowIdsState } from '../../states/tableRowIdsState';
|
||||||
|
|
||||||
import { useResetTableRowSelection } from './useResetTableRowSelection';
|
|
||||||
|
|
||||||
type useSetRecordTableDataProps = {
|
type useSetRecordTableDataProps = {
|
||||||
onEntityCountChange: (entityCount: number) => void;
|
onEntityCountChange: (entityCount: number) => void;
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,6 @@ import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObje
|
|||||||
import { useRecordTableContextMenuEntries } from '@/object-record/hooks/useRecordTableContextMenuEntries';
|
import { useRecordTableContextMenuEntries } from '@/object-record/hooks/useRecordTableContextMenuEntries';
|
||||||
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
|
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
|
||||||
import { filterAvailableTableColumns } from '@/object-record/utils/filterAvailableTableColumns';
|
import { filterAvailableTableColumns } from '@/object-record/utils/filterAvailableTableColumns';
|
||||||
import { signInBackgroundMockCompanies } from '@/sign-in-background-mock/constants/signInBackgroundMockCompanies';
|
|
||||||
import {
|
import {
|
||||||
signInBackgroundMockColumnDefinitions,
|
signInBackgroundMockColumnDefinitions,
|
||||||
signInBackgroundMockFilterDefinitions,
|
signInBackgroundMockFilterDefinitions,
|
||||||
@ -66,7 +65,6 @@ export const SignInBackgroundMockContainerEffect = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
setAvailableTableColumns(availableTableColumns);
|
setAvailableTableColumns(availableTableColumns);
|
||||||
setRecordTableData(signInBackgroundMockCompanies);
|
|
||||||
|
|
||||||
setTableColumns(
|
setTableColumns(
|
||||||
mapViewFieldsToColumnDefinitions(
|
mapViewFieldsToColumnDefinitions(
|
||||||
|
Loading…
Reference in New Issue
Block a user