mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-23 18:17:44 +02:00
fix(properties): toast on failed board drag to a property column
Property-column drags rolled the card back silently on failure; mirror the status/assignee drag path (use-issue-surface-actions) so the snap-back is explained (clean-room review F3, drag half). Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
} from "@dnd-kit/core";
|
||||
import type { QueryKey } from "@tanstack/react-query";
|
||||
import { arrayMove } from "@dnd-kit/sortable";
|
||||
import { toast } from "sonner";
|
||||
import type {
|
||||
Issue,
|
||||
IssueAssigneeGroup,
|
||||
@@ -205,17 +206,33 @@ export function BoardView({
|
||||
const applyPropertyGroupValue = useCallback(
|
||||
(group: BoardColumnGroup, issueId: string) => {
|
||||
if (group.propertyId === undefined) return;
|
||||
// Surface failures like status/assignee drags do (use-issue-surface-
|
||||
// actions): the mutation rolls the card back, but without a toast the
|
||||
// snap-back reads as a UI glitch instead of a rejected write.
|
||||
const onError = (err: unknown) => {
|
||||
toast.error(
|
||||
err instanceof Error && err.message
|
||||
? err.message
|
||||
: t(($) => $.page.move_failed),
|
||||
);
|
||||
};
|
||||
if (group.propertyOptionId === null) {
|
||||
unsetIssuePropertyMutation.mutate({ issueId, propertyId: group.propertyId });
|
||||
unsetIssuePropertyMutation.mutate(
|
||||
{ issueId, propertyId: group.propertyId },
|
||||
{ onError },
|
||||
);
|
||||
} else if (group.propertyOptionId !== undefined) {
|
||||
setIssuePropertyMutation.mutate({
|
||||
issueId,
|
||||
propertyId: group.propertyId,
|
||||
value: group.propertyOptionId,
|
||||
});
|
||||
setIssuePropertyMutation.mutate(
|
||||
{
|
||||
issueId,
|
||||
propertyId: group.propertyId,
|
||||
value: group.propertyOptionId,
|
||||
},
|
||||
{ onError },
|
||||
);
|
||||
}
|
||||
},
|
||||
[setIssuePropertyMutation, unsetIssuePropertyMutation],
|
||||
[setIssuePropertyMutation, t, unsetIssuePropertyMutation],
|
||||
);
|
||||
const sortFieldKey = sortBy === "created_at" ? "created" : sortBy;
|
||||
const sortPropertyId = propertyIdFromViewKey(sortBy);
|
||||
|
||||
Reference in New Issue
Block a user