From 96972bbe9857f52d5b5299e9d4810e0c48b21d9f Mon Sep 17 00:00:00 2001 From: Oscar Date: Thu, 20 Apr 2023 14:32:06 +0200 Subject: [PATCH 1/5] Try to fix problem with editor-document-title --- app/components/editor-document-title.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/components/editor-document-title.js b/app/components/editor-document-title.js index 0e75985d3..f6c513a58 100644 --- a/app/components/editor-document-title.js +++ b/app/components/editor-document-title.js @@ -41,7 +41,7 @@ export default class EditorDocumentTitleComponent extends Component { submit(event) { event.preventDefault(); this.args.onSubmit?.(this.title); - this.toggleActive(); + this.toggleActive(false); this.showSaved = true; setTimeout(() => (this.showSaved = false), 30000); return false; @@ -51,16 +51,24 @@ export default class EditorDocumentTitleComponent extends Component { cancel(event) { if (!event.currentTarget.contains(event.relatedTarget)) { this._title = undefined; - this.toggleActive(); + this.toggleActive(false); } } @action - toggleActive() { + toggleActive(activeValue) { if (this.active && !this.title) { this.error = true; } else { - this.active = !this.active; + console.log(activeValue); + if (activeValue !== undefined) { + console.log(this.active); + if (activeValue !== this.active) { + this.active = activeValue; + } + } else { + this.active = !this.active; + } } } From 2181659690a4289b979a2f50d0afdc92db4f0091 Mon Sep 17 00:00:00 2001 From: Oscar Date: Thu, 20 Apr 2023 14:46:56 +0200 Subject: [PATCH 2/5] added version info --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index da6bcdd76..f875d5bc8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "frontend-gelinkt-notuleren", - "version": "3.4.0", + "version": "3.4.1", "private": true, "description": "Ember frontend of the Gelinkt Notuleren application", "repository": { From 1edd0835957aeaeba1f7b449a3a174a5e40a9dbd Mon Sep 17 00:00:00 2001 From: Oscar Date: Thu, 20 Apr 2023 15:04:02 +0200 Subject: [PATCH 3/5] remove console.logs and version info --- app/components/editor-document-title.js | 2 -- package.json | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/components/editor-document-title.js b/app/components/editor-document-title.js index f6c513a58..b730ac3ae 100644 --- a/app/components/editor-document-title.js +++ b/app/components/editor-document-title.js @@ -60,9 +60,7 @@ export default class EditorDocumentTitleComponent extends Component { if (this.active && !this.title) { this.error = true; } else { - console.log(activeValue); if (activeValue !== undefined) { - console.log(this.active); if (activeValue !== this.active) { this.active = activeValue; } diff --git a/package.json b/package.json index f875d5bc8..da6bcdd76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "frontend-gelinkt-notuleren", - "version": "3.4.1", + "version": "3.4.0", "private": true, "description": "Ember frontend of the Gelinkt Notuleren application", "repository": { From 63de6d0bd435309f6b540ca2457f1d70559dbe83 Mon Sep 17 00:00:00 2001 From: Oscar Date: Fri, 21 Apr 2023 11:03:03 +0200 Subject: [PATCH 4/5] improve solution to the bug --- app/components/editor-document-title.hbs | 2 +- app/components/editor-document-title.js | 27 ++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/components/editor-document-title.hbs b/app/components/editor-document-title.hbs index 57de8ddff..528a678cf 100644 --- a/app/components/editor-document-title.hbs +++ b/app/components/editor-document-title.hbs @@ -33,7 +33,7 @@ {{else}}

{{limit-content this.title 70}} - {{t "editor-document-title.change-title"}} + {{t "editor-document-title.change-title"}}

{{#if this.showSaved}} (this.showSaved = false), 30000); return false; @@ -51,22 +51,27 @@ export default class EditorDocumentTitleComponent extends Component { cancel(event) { if (!event.currentTarget.contains(event.relatedTarget)) { this._title = undefined; - this.toggleActive(false); + this.disabledEdit(); } } @action - toggleActive(activeValue) { - if (this.active && !this.title) { + enableEdit() { + if (this.active) { + return; + } + this.active = true; + } + + @action + disabledEdit() { + if (!this.active) { + return; + } + if (!this.title) { this.error = true; } else { - if (activeValue !== undefined) { - if (activeValue !== this.active) { - this.active = activeValue; - } - } else { - this.active = !this.active; - } + this.active = false; } } From 5fece013d37d80e381e1ae5e8d19823cec70d820 Mon Sep 17 00:00:00 2001 From: Oscar Date: Fri, 21 Apr 2023 12:48:23 +0200 Subject: [PATCH 5/5] Add comment to explain the bug --- app/components/editor-document-title.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/components/editor-document-title.js b/app/components/editor-document-title.js index b7f044b3a..cf1491cc7 100644 --- a/app/components/editor-document-title.js +++ b/app/components/editor-document-title.js @@ -55,6 +55,8 @@ export default class EditorDocumentTitleComponent extends Component { } } + // We check the value of active in these 2 functions to avoid setting it 2 times in the same computation with + // the cancel event + submit which cause a bug in prod environments. @action enableEdit() { if (this.active) {