@social-mail/social-mail-client 1.1.3 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -45,8 +45,6 @@ export default function CollectionEditor<T>({
45
45
 
46
46
  const onAddItem = async () => {
47
47
  const es = repeater.app.resolve(EntityService);
48
- const clone = es.cloner(model).copy;
49
- const copy = (clone[collection] ??= [] as any) as any;
50
48
  let newItem;
51
49
  if (addPage) {
52
50
  const result = await PageNavigator.pushPageForResult(addPage, addItemDefaults ?? {});
@@ -61,8 +59,10 @@ export default function CollectionEditor<T>({
61
59
  if (newItem?.then) {
62
60
  newItem = await newItem;
63
61
  }
64
- copy.push(newItem);
65
- await es.save(clone as any);
62
+ const draft = { model, [collection]: [newItem] };
63
+ const clone = es.cloner(draft);
64
+ clone.include(`(x) => x.${collection}` as any);
65
+ await es.save(clone.copy as any);
66
66
  repeater.items.add(newItem);
67
67
  };
68
68