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