Language metadata launchs JavaScript error

Hi,
OJS 3.2.1-1 (upgraded from 3.1.1-4)
LAMP

When editing the Language field metadata in a submission I’m getting a duplicated entry. One seems accepted by the system, and the other remains in “still-editing” mode, as shown below.
metadato-idioma-carga-duplicado

By viewing Chrome’s Console I see the following when entering the first character of the language

TypeError: this.suggestions.filter is not a function
   at o.filteredSuggestions (build.js?v=3.2.1.1:formatted:21326)
   at ri.get (build.js?v=3.2.1.1:formatted:35613)
   at ri.evaluate (build.js?v=3.2.1.1:formatted:35672)
   at o.filteredSuggestions (build.js?v=3.2.1.1:formatted:35785)
   at o.Ke (build.js?v=3.2.1.1:formatted:20335)
   at o.e._render (build.js?v=3.2.1.1:formatted:35179)
   at o.i (build.js?v=3.2.1.1:formatted:35432)
   at ri.get (build.js?v=3.2.1.1:formatted:35613)
   at ri.run (build.js?v=3.2.1.1:formatted:35655)
   at Qn (build.js?v=3.2.1.1:formatted:35545)
ot @ build.js?v=3.2.1.1:formatted:34491
at @ build.js?v=3.2.1.1:formatted:34486
it @ build.js?v=3.2.1.1:formatted:34460
e._render @ build.js?v=3.2.1.1:formatted:35181
i @ build.js?v=3.2.1.1:formatted:35432
ri.get @ build.js?v=3.2.1.1:formatted:35613
ri.run @ build.js?v=3.2.1.1:formatted:35655
Qn @ build.js?v=3.2.1.1:formatted:35545
(anonymous) @ build.js?v=3.2.1.1:formatted:34536
dt @ build.js?v=3.2.1.1:formatted:34499
Promise.then (async)
st @ build.js?v=3.2.1.1:formatted:34504
_t @ build.js?v=3.2.1.1:formatted:34545
ni @ build.js?v=3.2.1.1:formatted:35582
ri.update @ build.js?v=3.2.1.1:formatted:35650
ve.notify @ build.js?v=3.2.1.1:formatted:34037
set @ build.js?v=3.2.1.1:formatted:34186
ai.set @ build.js?v=3.2.1.1:formatted:35704
callback @ build.js?v=3.2.1.1:formatted:20345
rt @ build.js?v=3.2.1.1:formatted:34468
n @ build.js?v=3.2.1.1:formatted:34598
rt @ build.js?v=3.2.1.1:formatted:34468
On.e.$emit @ build.js?v=3.2.1.1:formatted:35354
inputHandler @ build.js?v=3.2.1.1:formatted:21131
rt @ build.js?v=3.2.1.1:formatted:34468
n @ build.js?v=3.2.1.1:formatted:34600
Ia.a._wrapper @ build.js?v=3.2.1.1:formatted:37054

metadato-idioma-error

How can this be solved?

Thanks in advance for your reply.

Regards,
Juan

Hi @jascanio,

Is there anything related to this in the PHP error log?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I’ve been digging into the error log and found no relevant entries.

What I see in the Chrome’s console is that the JavaScript filteredSuggestions (lib build.js) the this.suggestions is an object instead of an array (unlinke disciplines or agencies) and launches a exception “filter is not a function”.

We have found that the languages API returns the following JSON

{"1":"Abjaziano","0":"Afar","2":"Afrikaans","25":"Alem\u00e1n","4":"Aragon\u00e9s","50":"Armenio","5":"Assamais","6":"Avaric","8":"Bambara","7":"Bashkir","10":"Bengal\u00ed","9":"Bieloruso","82":"Birmano","11":"Bislama","13":"Bosnio","14":"Bret\u00f3n","27":"Butan\u00ed","15":"B\u00falgaro","59":"Canar\u00e9s","16":"Catal\u00e1n","63":"Central Khmer","18":"Chamorro","19":"Checheno","17":"Checo","20":"Chuvash","102":"Cingal\u00e9s","67":"Coreano","22":"Corso","48":"Croata","21":"C\u00f3rnico","24":"Dan\u00e9s","26":"Dhivehi","103":"Eslovaco","104":"Esloveno","111":"Espa\u00f1ol","31":"Ewe","32":"Fero\u00e9s","33":"Fidji","34":"Fin\u00e9s","35":"Franc\u00e9s","39":"Galician","23":"Gal\u00e9s","75":"Ganda","61":"Georgiano","42":"Haitian","43":"Haussa","44":"Hebreo","45":"Herero","46":"Hindi","47":"Hiri Motu","49":"H\u00fangaro","51":"Igbo","53":"Indonesio","29":"Ingl\u00e9s","38":"Irland\u00e9s","54":"Island\u00e9s","55":"Italiano","57":"Japon\u00e9s","56":"Javan\u00e9s","58":"Kalaallisut","60":"Kashmir","62":"Kazako","64":"Kikuyu","65":"Kinyarwanda","66":"Kirghizo","99":"Kiroundi","68":"Kuanyama","70":"Limburgan","71":"Lingala","72":"Lituano","74":"Luba-Katanga","73":"Luxembourgish","79":"Macedonio","80":"Malt\u00e9s","40":"Manx [Ga\u00e9lico de Manx]","81":"Maor\u00ed","78":"Marath","76":"Marshallese","28":"Modern Greek (1453-)","83":"Nauru","84":"Navajo","87":"Ndonga","88":"Neerland\u00e9s (Holand\u00e9s)","86":"North Ndebele","105":"Northern Sami","89":"Noruego Nynorsk","90":"Norwegian Bokm\u00e5l","91":"Nyanja","92":"Occitan (post 1500)","93":"Ossetian","94":"Panjabi","95":"Polaco","96":"Portugu\u00e9s","97":"Romansh","98":"Rumano","100":"Ruso","106":"Samoano","101":"Sango","37":"Scottish Gaelic","112":"Serbio","125":"Setchwana","107":"Shona","52":"Sichuan Yi","108":"Sindhi","113":"Siswati","109":"Somal\u00ed","114":"Sondan\u00e9s","85":"South Ndebele","110":"Southern Sotho","115":"Sueco","121":"Tagalo","116":"Tahitiano","122":"Tailand\u00e9s","120":"Tajiko","117":"Tamil","118":"Tataro","129":"Tchi","119":"Telugu","12":"Tibetano","123":"Tigrinya","124":"Tonga (Islas Tonga)","126":"Tsonga","128":"Turco","127":"Turkmeno","130":"Uiguro","131":"Ukranio","132":"Urdu","30":"Vasco","133":"Venda","134":"Vietnamita","36":"Western Frisian","136":"Wolof","137":"Xhosa","138":"Yoruba","139":"Zulu","41":"guyarat\u00ed","69":"laosiano","77":"malabar","135":"val\u00f3n","3":"\u00c1m\u00e1rico"}

Hope this helps.

Thanks in advance for your reply.

Regards,
Juan

Hi again @asmecher,

Issue update.

The only way we have found to solve the issue is to return from the associative array $languageNames, the values part making an array_values($languageNames) in line 102 of file
lib/pkp/api/v1/vocabs/PKPVocabHandler.inc.php

This way we have solved the problem with language metadata, although we’ve had to hack the code, which we are sure it is not the path to the solution to our problem.

Hope this helps you to figure out what is wrong with our OJS instance. Maybe something went wrong with our upgrade procedure. We don’t know.

Thanks in advance for your help.

Regards,
Juan