Fix the bug : The /plugins page was displaying "Loading..." indefin…#939
Fix the bug : The /plugins page was displaying "Loading..." indefin…#939jyjeanne wants to merge 1 commit intodita-ot:masterfrom
/plugins page was displaying "Loading..." indefin…#939Conversation
…itely with JavaScript error:... Signed-off-by: jeremy <jyjeanne@gmail.com>
|
@infotexture @jelovirt i think there is also a problem into all.json file : We also need a data fix. Change the 3 array-wrapped alias entries to plain objects, consistent with the other 4 alias entries: "org.doctales.ant-contrib": { "alias": "org.jung.ant-contrib" },
"org.doctales.schematron": { "alias": "org.jung.schematron" },
"org.doctales.terminology": { "alias": "org.jung.terminology" }Currently they are: "org.doctales.ant-contrib": [{ "alias": "org.jung.ant-contrib" }],
"org.doctales.schematron": [{ "alias": "org.jung.schematron" }],
"org.doctales.terminology": [{ "alias": "org.jung.terminology" }] |
Remove the outer array from the 3 JSON files that wrap a single alias object in an array, converting them to plain objects matching the pattern used by the other alias files. Closes dita-ot/website#939 Signed-off-by: Roger Sheen <roger@infotexture.net>
|
@jyjeanne Thanks for your efforts here, but there was nothing wrong with the JavaScript code here in the website repo. As you pointed out in your comment above, the root cause was a problem with the format of those recently merged alias entries in the plug-in registry. Removing the outer array there in dita-ot/registry#171 was enough to resolve the issue. |
|
@infotexture Thanks for your message . Upon my first analysis, I mistakenly focused on the JavaScript error in the Chrome browser console, but after a second, more thorough investigation of the all.json file, it became clear that the issue was into data. |
Remove the outer array from the 3 JSON files that wrap a single alias object in an array, converting them to plain objects matching the pattern used by the other alias files. Closes dita-ot/website#939 Signed-off-by: Roger Sheen <roger@infotexture.net> Signed-off-by: Jason Fox <jason.fox@fiware.org>
Remove the outer array from the 3 JSON files that wrap a single alias object in an array, converting them to plain objects matching the pattern used by the other alias files. Closes dita-ot/website#939 Signed-off-by: Roger Sheen <roger@infotexture.net> Signed-off-by: Jason Fox <jason.fox@fiware.org>
Problem
@infotexture The plugins registry page at
https://www.dita-ot.org/pluginswas failing to load with a JavaScript error, leaving users with a perpetual "Loading..." message:Root Cause
The
list()function in_js/plugins.jsfilters and sorts plugins from the registry API before rendering. The code assumed all plugin entries were valid arrays containing objects with anameproperty:However, the API response from
https://plugins.dita-ot.org/_all.jsoncontains some entries that are:[]undefinedornullelementsnamepropertyWhen the sort function attempts to access
a[0].nameorb[0].nameon these malformed entries, it throws a TypeError.Solution
Enhanced the filter validation to check all required properties before attempting to sort:
This ensures that only valid plugin entries proceed to the sort step by validating:
!!plugin- Plugin exists (notnull/undefined)!plugin.alias- Not an alias entry (existing check)plugin.length > 0- Array has at least one elementplugin[0]- First element existsplugin[0].name- Name property existsTesting
✅ Tested locally with production plugin data from the registry API
✅ Verified plugin list displays correctly without errors
✅ Verified search and filter functionality works
✅ Confirmed no console errors in browser DevTools
Before
After
Files Changed
_js/plugins.js- Added enhanced validation to filter (1 line changed)