@burdenoff/planmagnet-fe-sdk 2026.706.2 → 2026.706.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2673,25 +2673,35 @@ function TaskCommentsCore({
2673
2673
  const authorName = (id) => id === currentActorId ? L.you : resolveAssignee?.(id)?.name ?? void 0;
2674
2674
  const post = async ({ text, mentionUserIds }, parentCommentId) => {
2675
2675
  setError(null);
2676
+ const base = {
2677
+ entityType,
2678
+ entityId,
2679
+ content: { text },
2680
+ contentType: "TEXT",
2681
+ ...parentCommentId ? { parentCommentId } : {}
2682
+ };
2683
+ const create = (withMentions) => createComment({
2684
+ variables: {
2685
+ input: withMentions && mentionUserIds.length ? { ...base, mentionUserIds } : base
2686
+ }
2687
+ });
2676
2688
  try {
2677
- await createComment({
2678
- variables: {
2679
- input: {
2680
- entityType,
2681
- entityId,
2682
- content: { text },
2683
- contentType: "TEXT",
2684
- ...parentCommentId ? { parentCommentId } : {},
2685
- ...mentionUserIds.length ? { mentionUserIds } : {}
2686
- }
2687
- }
2688
- });
2689
- await refetch();
2690
- setReplyingTo(null);
2689
+ await create(true);
2691
2690
  } catch (err) {
2692
- setError(L.failedToComment);
2693
- throw err;
2691
+ if (mentionUserIds.length) {
2692
+ try {
2693
+ await create(false);
2694
+ } catch (err2) {
2695
+ setError(L.failedToComment);
2696
+ throw err2;
2697
+ }
2698
+ } else {
2699
+ setError(L.failedToComment);
2700
+ throw err;
2701
+ }
2694
2702
  }
2703
+ await refetch();
2704
+ setReplyingTo(null);
2695
2705
  };
2696
2706
  const handleDelete = async (id) => {
2697
2707
  setError(null);
@@ -2704,7 +2714,7 @@ function TaskCommentsCore({
2704
2714
  };
2705
2715
  const renderBody = (c) => {
2706
2716
  const text = c.content?.text ?? "";
2707
- const names = (c.mentions ?? []).map((m) => resolveAssignee?.(m.mentionedUserId)?.name).filter((n) => Boolean(n));
2717
+ const names = (members ?? []).map((m) => m.name).filter((n) => text.includes(`@${n}`));
2708
2718
  if (names.length === 0) return text;
2709
2719
  const tokens = new Set(names.map((n) => `@${n}`));
2710
2720
  const re = new RegExp(`(@(?:${names.map(escapeRe).join("|")}))`, "g");