Bug 32104

Summary: Console error on additional_content.pl after saving
Product: Koha Reporter: Lucas Gass <lucas>
Component: ToolsAssignee: Lucas Gass <lucas>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00
Attachments: Bug 32104: Prevent console error on additonal-contents.pl
Bug 32104: Prevent console error on additonal-contents.pl
Bug 32104: Prevent console error on additonal-contents.pl

Description Lucas Gass 2022-11-03 21:27:17 UTC
To recreate:
1. Make a new HTML customization, news item, or page with the text editor ( CodeMirror ). 
2. Save the content ( not Save and continue )
3. Notice the console error:

Uncaught TypeError: firstTab[0] is undefined

This only seems to happen for me when using CodeMirror. Using the WYSIWYG editor does not produce the console error.
Comment 1 Lucas Gass 2022-11-03 22:22:33 UTC
Created attachment 143154 [details] [review]
Bug 32104: Prevent console error on additonal-contents.pl

To test:
1. Make a new HTML customization, news item, or page with the text editor ( CodeMirror ).
2. Save the content ( not Save and continue )
3. Notice the console error:
4. Apply patch
5. Try 1 & 2 again.
6. No error.
Comment 2 David Nind 2022-11-04 08:08:01 UTC
Created attachment 143164 [details] [review]
Bug 32104: Prevent console error on additonal-contents.pl

To test:
1. Make a new HTML customization, news item, or page with the text editor ( CodeMirror ).
2. Save the content ( not Save and continue )
3. Notice the console error:
4. Apply patch
5. Try 1 & 2 again.
6. No error.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Katrin Fischer 2022-11-09 23:12:02 UTC
I didn't see the console error on master - could you please verify if maybe bug 31609 fixed this?
Comment 4 Lucas Gass 2022-11-10 00:42:27 UTC
(In reply to Katrin Fischer from comment #3)
> I didn't see the console error on master - could you please verify if maybe
> bug 31609 fixed this?

It did not, the console error remains.
Comment 5 Katrin Fischer 2022-11-10 00:43:15 UTC
I couldn't make it happen when I tried earlier, maybe another set of eyes would help.
Comment 6 Lucas Gass 2022-11-10 00:45:22 UTC
It looks like I can only make the error happen when using Firefox.
Comment 7 Katrin Fischer 2022-11-10 00:46:07 UTC
(In reply to Lucas Gass from comment #6)
> It looks like I can only make the error happen when using Firefox.

Hm I did use Firefox :(
Comment 8 Jonathan Druart 2022-11-11 13:53:03 UTC
Same for me, I don't get the error (using Firefox).
Comment 9 Lucas Gass 2022-11-16 15:57:32 UTC
(In reply to Jonathan Druart from comment #8)
> Same for me, I don't get the error (using Firefox).

Interesting! Not quite sure what is going on here.
Comment 10 Tomás Cohen Arazi 2022-11-17 18:03:55 UTC
Created attachment 144021 [details] [review]
Bug 32104: Prevent console error on additonal-contents.pl

To test:
1. Make a new HTML customization, news item, or page with the text editor ( CodeMirror ).
2. Save the content ( not Save and continue )
3. Notice the console error:
4. Apply patch
5. Try 1 & 2 again.
6. No error.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 11 Tomás Cohen Arazi 2022-11-17 18:04:39 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 12 Jonathan Druart 2022-11-18 05:50:56 UTC
(In reply to Tomás Cohen Arazi from comment #11)
> Pushed to master for 22.11.

Did you get the warning?