fix: front not running properly (#971)

This commit is contained in:
Jérémy M 2023-07-28 11:36:27 +02:00 committed by GitHub
parent 2cc63e14aa
commit 44a9c2687f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
import { MultipleEntitySelect } from '@/ui/relation-picker/components/MultipleEntitySelect'; import { MultipleEntitySelect } from '@/ui/relation-picker/components/MultipleEntitySelect';
import { RelationPickerHotkeyScope } from '@/ui/relation-picker/types/RelationPickerHotkeyScope'; import { RelationPickerHotkeyScope } from '@/ui/relation-picker/types/RelationPickerHotkeyScope';
import { Activity, ActivityTarget, CommentableType } from '~/generated/graphql'; import { Activity, ActivityTarget, CommentableType } from '~/generated/graphql';
import { assertNotNull } from '~/utils/assert';
import { useHandleCheckableActivityTargetChange } from '../hooks/useHandleCheckableActivityTargetChange'; import { useHandleCheckableActivityTargetChange } from '../hooks/useHandleCheckableActivityTargetChange';
import { flatMapAndSortEntityForSelectArrayOfArrayByName } from '../utils/flatMapAndSortEntityForSelectArrayByName'; import { flatMapAndSortEntityForSelectArrayOfArrayByName } from '../utils/flatMapAndSortEntityForSelectArrayByName';
@ -86,7 +87,8 @@ export function ActivityRelationPicker({ activity }: OwnProps) {
() => () =>
activity?.activityTargets activity?.activityTargets
?.filter((relation) => relation.commentableType === 'Person') ?.filter((relation) => relation.commentableType === 'Person')
.map((relation) => relation.commentableId) ?? [], .map((relation) => relation.commentableId)
.filter(assertNotNull) ?? [],
[activity?.activityTargets], [activity?.activityTargets],
); );
@ -94,7 +96,8 @@ export function ActivityRelationPicker({ activity }: OwnProps) {
() => () =>
activity?.activityTargets activity?.activityTargets
?.filter((relation) => relation.commentableType === 'Company') ?.filter((relation) => relation.commentableType === 'Company')
.map((relation) => relation.commentableId) ?? [], .map((relation) => relation.commentableId)
.filter(assertNotNull) ?? [],
[activity?.activityTargets], [activity?.activityTargets],
); );

View File

@ -70,7 +70,9 @@ export function useHandleCheckableActivityTargetChange({
}); });
const activityTargetIdsToDelete = activity.activityTargets const activityTargetIdsToDelete = activity.activityTargets
.filter(({ commentableId }) => !entityValues[commentableId]) .filter(
({ commentableId }) => commentableId && !entityValues[commentableId],
)
.map(({ id }) => id); .map(({ id }) => id);
if (activityTargetIdsToDelete.length) if (activityTargetIdsToDelete.length)