Skip to content
Snippets Groups Projects
Commit 66589f70 authored by Hermann's avatar Hermann
Browse files

fix reloading of group after patching

parent fe0ec541
No related branches found
No related tags found
No related merge requests found
......@@ -181,6 +181,8 @@ class EmailTable {
export default class viewGroup extends ItemView {
view() {
// update the reference to the controller data, as this may be refreshed in between
this.data = this.controller.data;
return this.layout([
// this div is the title line
m('div.maincontainer', [
......@@ -214,7 +216,7 @@ export default class viewGroup extends ItemView {
list: this.data.receive_from || [],
onSubmit: (newItem) => {
const oldList = this.data.receive_from || [];
this.handler.patch({
this.controller.patch({
_id: this.data._id,
_etag: this.data._etag,
receive_from: [...oldList, newItem],
......@@ -226,11 +228,11 @@ export default class viewGroup extends ItemView {
const index = oldList.indexOf(item);
if (index !== -1) {
oldList.splice(index, 1);
this.handler.patch({
this.controller.patch({
_id: this.data._id,
_etag: this.data._etag,
receive_from: oldList,
}).then(() => m.redraw());
});
}
},
}),
......
......@@ -52,8 +52,6 @@ export default class ItemView {
layout(children) {
if (!this.controller || !this.controller.data) return m(loadingScreen);
// update the reference to the controller data, as this may be refreshed in between
this.data = this.controller.data;
return m('div', [
m(Toolbar, m('div.pe-button-row', [
m(Button, {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment