refactor: explicit typing for SharePrompt

This commit is contained in:
Danny Avila 2024-09-03 18:56:46 -04:00
parent 0a328e643d
commit e54352e4c7
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364

View file

@ -31,7 +31,7 @@ const SharePrompt = ({ group, disabled }: { group?: TPromptGroup; disabled: bool
const { data: startupConfig = {} as TStartupConfig, isFetching } = useGetStartupConfig();
const { instanceProjectId } = startupConfig;
const groupIsGlobal = useMemo(
() => !!group?.projectIds?.includes(instanceProjectId),
() => !!(group?.projectIds ?? []).includes(instanceProjectId),
[group, instanceProjectId],
);
@ -57,7 +57,8 @@ const SharePrompt = ({ group, disabled }: { group?: TPromptGroup; disabled: bool
}
const onSubmit = (data: FormValues) => {
if (!group._id || !instanceProjectId) {
const groupId = group._id ?? '';
if (!groupId || !instanceProjectId) {
return;
}
@ -70,7 +71,7 @@ const SharePrompt = ({ group, disabled }: { group?: TPromptGroup; disabled: bool
}
updateGroup.mutate({
id: group._id,
id: groupId,
payload,
});
};