tycho-components 0.23.9 → 0.23.10

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.
@@ -51,16 +51,21 @@ export default function Comments({ uid, keywords, references, mode, onClose, onC
51
51
  if (!comment) {
52
52
  const updated = [...(comments || []), el];
53
53
  setComments(updated);
54
+ onChange?.(updated);
54
55
  }
55
56
  else {
56
- setComments((prev) => prev?.map((c) => (c.id === comment.id ? el : c)));
57
+ const updated = comments?.map((c) => (c.id === comment.id ? el : c)) || [];
58
+ setComments(updated);
59
+ onChange?.(updated);
57
60
  }
58
61
  } })), comments?.length === 0 && (_jsx(AppPlaceholder, { text: t('placeholder.comments.empty') })), comments?.map((el, idx) => (_jsxs("div", { className: "thread", children: [!el.reply && (_jsx(CommentInfo, { comment: el, onRemove: () => {
59
62
  const updated = comments?.filter((c) => c.id !== el.id);
60
63
  setComments(updated);
61
64
  onChange && onChange(updated || []);
62
65
  }, onUpdate: (thisComment) => {
63
- setComments(comments?.map((c) => c.id === thisComment.id ? { ...c, ...thisComment } : c));
66
+ const updated = comments?.map((c) => c.id === thisComment.id ? { ...c, ...thisComment } : c) || [];
67
+ setComments(updated);
68
+ onChange?.(updated);
64
69
  }, onEdit: () => {
65
70
  setComment(el);
66
71
  setOpenAddComment(true);
@@ -74,9 +79,11 @@ export default function Comments({ uid, keywords, references, mode, onClose, onC
74
79
  setComments(updated);
75
80
  onChange && onChange(updated || []);
76
81
  }, onUpdate: (thisComment) => {
77
- setComments(comments?.map((c) => c.id === thisComment.id
82
+ const updated = comments?.map((c) => c.id === thisComment.id
78
83
  ? { ...c, ...thisComment }
79
- : c));
84
+ : c) || [];
85
+ setComments(updated);
86
+ onChange?.(updated);
80
87
  }, onEdit: () => {
81
88
  setComment(rel);
82
89
  setOpenAddComment(true);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.23.9",
4
+ "version": "0.23.10",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {