diff --git a/js/src/components/Resource/ResourceSelector.vue b/js/src/components/Resource/ResourceSelector.vue
index e1aa4acd..90ccb602 100644
--- a/js/src/components/Resource/ResourceSelector.vue
+++ b/js/src/components/Resource/ResourceSelector.vue
@@ -59,7 +59,7 @@
{{ $t("No resources in this folder") }}
cachedResource.id !== updatedResource.id
);
@@ -634,7 +633,15 @@ export default class Resources extends Mixins(ResourceMixin) {
path: parentPath,
username: this.resource.actor.preferredUsername,
},
- data: { oldParentCachedResource },
+ data: {
+ resource: {
+ ...oldParentCachedResource,
+ children: {
+ ...oldParentCachedResource.children,
+ elements: [...updatedElementList],
+ },
+ },
+ },
});
console.log("Finished removing ressource from old parent");
@@ -659,15 +666,24 @@ export default class Resources extends Mixins(ResourceMixin) {
return;
}
- newParentCachedResource.children.elements.push(resource);
-
store.writeQuery({
query: GET_RESOURCE,
variables: {
path: updatedResource.parent.path,
username: this.resource.actor.preferredUsername,
},
- data: { newParentCachedResource },
+ data: {
+ resource: {
+ ...newParentCachedResource,
+ children: {
+ ...newParentCachedResource.children,
+ elements: [
+ ...newParentCachedResource.children.elements,
+ resource,
+ ],
+ },
+ },
+ },
});
console.log("Finished adding resource to new parent");
},