@burdenoff/planmagnet-fe-sdk 2026.706.1 → 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
@@ -2632,12 +2632,14 @@ function TaskCommentsCore({
2632
2632
  GET_ENTITY_COMMENTS,
2633
2633
  {
2634
2634
  // No parentCommentId → the service returns EVERY comment (all levels)
2635
- // flat; we build the thread tree client-side via threadRootId.
2635
+ // flat; we build the thread tree client-side via threadRootId. `take` is
2636
+ // capped at 100 by the conversations service (a higher value is rejected
2637
+ // with a validation error), which is ample for a single work item.
2636
2638
  variables: {
2637
2639
  input: {
2638
2640
  entityType,
2639
2641
  entityId,
2640
- take: 200,
2642
+ take: 100,
2641
2643
  sortBy: "createdAt",
2642
2644
  sortOrder: "asc"
2643
2645
  }
@@ -2671,25 +2673,35 @@ function TaskCommentsCore({
2671
2673
  const authorName = (id) => id === currentActorId ? L.you : resolveAssignee?.(id)?.name ?? void 0;
2672
2674
  const post = async ({ text, mentionUserIds }, parentCommentId) => {
2673
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
+ });
2674
2688
  try {
2675
- await createComment({
2676
- variables: {
2677
- input: {
2678
- entityType,
2679
- entityId,
2680
- content: { text },
2681
- contentType: "TEXT",
2682
- ...parentCommentId ? { parentCommentId } : {},
2683
- ...mentionUserIds.length ? { mentionUserIds } : {}
2684
- }
2685
- }
2686
- });
2687
- await refetch();
2688
- setReplyingTo(null);
2689
+ await create(true);
2689
2690
  } catch (err) {
2690
- setError(L.failedToComment);
2691
- 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
+ }
2692
2702
  }
2703
+ await refetch();
2704
+ setReplyingTo(null);
2693
2705
  };
2694
2706
  const handleDelete = async (id) => {
2695
2707
  setError(null);
@@ -2702,7 +2714,7 @@ function TaskCommentsCore({
2702
2714
  };
2703
2715
  const renderBody = (c) => {
2704
2716
  const text = c.content?.text ?? "";
2705
- 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}`));
2706
2718
  if (names.length === 0) return text;
2707
2719
  const tokens = new Set(names.map((n) => `@${n}`));
2708
2720
  const re = new RegExp(`(@(?:${names.map(escapeRe).join("|")}))`, "g");