Skip to content
Snippets Groups Projects
Commit 0c97769d authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Prevent OrientationPanel from patching on mount or element change

parent 9072a72a
No related branches found
No related tags found
1 merge request!1027Prevent OrientationPanel from patching on mount or element change
......@@ -66,7 +66,16 @@ export default {
if (!this.loading) this.mirrored = !this.mirrored
},
async updateElement () {
if (this.loading) return
/*
* When the component is loaded, when the element changes while browsing between neighbors
* or when the element is loaded after the component, a watcher updates this component's fields
* to keep them up-to-date with the element.
* This update can cause updateElement to trigger, and that could cause unnecessary PATCH requests
* to update the element's attributes to the ones it already has.
* If the user does not have write access, this could also cause 403 errors.
* We prevent this by not allowing any PATCH requests if the element's attributes are the same as our fields.
*/
if (this.loading || (this.rotationAngle === this.element.rotation_angle && this.mirrored === this.element.mirrored)) return
this.loading = true
try {
await this.patch({
......
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