Hot fix for currentWorkspaceMember not found error on blocklist page (#11367)

Fixes
https://twenty-v7.sentry.io/issues/6504066204/?project=4507072563183616
Introduced by https://github.com/twentyhq/twenty/pull/11325

Called it a hotfix as not sure if missing currentWorkspaceMember is an
expected state - maybe it is expected to be temporarily missing ?
This commit is contained in:
Marie
2025-04-03 10:44:11 +02:00
committed by GitHub
parent 0df07a766a
commit 8c9fcfe5a4

View File

@ -10,23 +10,23 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { SettingsAccountsBlocklistInput } from '@/settings/accounts/components/SettingsAccountsBlocklistInput';
import { SettingsAccountsBlocklistTable } from '@/settings/accounts/components/SettingsAccountsBlocklistTable';
import { useLingui } from '@lingui/react/macro';
import { isDefined } from 'twenty-shared/utils';
export const SettingsAccountsBlocklistSection = () => {
const { t } = useLingui();
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
if (!currentWorkspaceMember) {
throw new Error('No workspace member found.');
}
const currentWorkspaceMemberId = currentWorkspaceMember?.id ?? '';
const { records: blocklist } = useFindManyRecords<BlocklistItem>({
objectNameSingular: CoreObjectNameSingular.Blocklist,
filter: {
workspaceMemberId: {
in: [currentWorkspaceMember.id],
in: [currentWorkspaceMemberId],
},
},
skip: !isDefined(currentWorkspaceMember),
});
const { createOneRecord: createBlocklistItem } =