Pkp-lib: Submission metadata form: pressing save button triggers browser errors

Created on 18 Sep 2018  路  17Comments  路  Source: pkp/pkp-lib

OJS 3.1.1-4

Tested with latest Chrome and Firefox. Reproduced on several OJS instances that was upgraded from v.3.0 and 3.1.1
Occurs on any stage except when an author submits an article. Nevertheless, the actual data entered in the form are saved. No errors in PHP logs. After pressing the save button form doesn't disappear:
metadataform

Critical Issue

Most helpful comment

I have hunted this bug also only to see that is already fixed. Darn. Here are my notes about from where the bug originates for reference.

  • create & finish submission
  • open review the submission" page
  • open metadata modal dialog
  • click save

    • response with a json object containing flag reloadContainer = true

    • AjaxFormHandler.js, handleResponse() is triggered

    • TabHandler.js, tabsReloadRequested() is called as a results of binding to the containerReloadRequested event



      • get request to reload tab, response is a json string with header Content-Type: application/json hence the browser automatically creates an 'Object' instead of a string from the response


      • now the success handler calls $.parseJSON(data) which throws an exception and the dialog breaks



All 17 comments

@Vitaliy-1 can you check the Network tab in the devtools? You should see the request that was sent when saving the form, and the response that was sent back. It seems the JSON is malformed, so there should be some hint in the response.

All request are successful but save-form request is taking 4 sec. Copied response:

{"status":true,"content":true,"elementId":"0","events":[{"name":"submissionUpdated","data":{"submissions":["127"],"isGlobalEvent":true}}],"reloadContainer":true,"tabsUrl":"http:\/\/ojs-3.1.1-1.test\/index.php\/psp\/$$$call$$$\/modals\/submission-metadata\/issue-entry\/fetch?submissionId=127&stageId=5&tabPos=0&hideHelp=1"}

@NateWr

Basically, the issue is present and in Health Sciences demo journal.

The lengthy wait on the request is probably because the search index is rebuilt whenever the metadata form is saved.

Do you still get the console error even when the request is successful and returns the response you copied?

Yes. Console error appears after request is successful and this response. Data entered in the form are saved, so the problem appears to be only with form dismissal.

Actually, errors appear after all XHR are fired, so nothing associated with them in the console. Moreover, sometimes I see only the second one.

Compared to the OJS 3.1.1-1, where no errors occur, there is missing request URL:
http://ojs-3.1.1-1.test/index.php/ojs/$$$call$$$/grid/users/author/author-grid/fetch-grid?submissionId=1&stageId=5&_=1538664183467

@NateWr Whole form is affected, including references and identifiers tabs: https://forum.pkp.sfu.ca/t/ojs-3-1-1-4-references-extraction-loop/49103

I've assigned this to the 3.2 milestone and given it a Critical Issue flag since several key forms are effectively broken.

I'm sorry I've let it drag on like this, but I just haven't been able to focus on too many different issues right now. I will look into it once my current workload is merged.

All, I've added a fix to pkp-lib (lib/pkp in your OJS install) that should resolve this. Please try applying https://github.com/asmecher/pkp-lib/commit/65475ba862e1ed5cad8f03ea34680be86a3dbe7e and confirm whether it works for you. Once I've gotten that through our Travis test environment I'll port it around to the various necessary branches.

Note that this only affects the front-end's parsing of the server response, so you won't have lost any metadata updates in the process.

Note that if you're using enable_minified in config.inc.php, you'll also need to update your minified Javascript. You can do that by applying https://github.com/pkp/ojs/commit/322f3aef0ed1a6f4ddbe1d6fcd5266d272a41c92 (ojs-stable-3_1_1).

Yep, it works.

I have hunted this bug also only to see that is already fixed. Darn. Here are my notes about from where the bug originates for reference.

  • create & finish submission
  • open review the submission" page
  • open metadata modal dialog
  • click save

    • response with a json object containing flag reloadContainer = true

    • AjaxFormHandler.js, handleResponse() is triggered

    • TabHandler.js, tabsReloadRequested() is called as a results of binding to the containerReloadRequested event



      • get request to reload tab, response is a json string with header Content-Type: application/json hence the browser automatically creates an 'Object' instead of a string from the response


      • now the success handler calls $.parseJSON(data) which throws an exception and the dialog breaks



Was this page helpful?
0 / 5 - 0 ratings