Fix deviceViewPanel to properly initialize panel entries (#7433)
Corrects the logic in deviceViewPanel to ensure that each plugin's panel entry is initialized as an object with header and content properties, and checks for the existence of both on_device_header and on_device_page functions before invoking them.
TheDevRyan committed
Nov 17, 2025 at 10:33 UTC
dd010f03e511104d9c4f92f346cae95669b0cac5
1 file changed
+5
-3
pluginHandler.js
+5
-3
@@ -200,10 +200,12 @@ module.exports.pluginHandler = function (parent) {
200
obj.deviceViewPanel = function () {
201
var panel = {};
202
for (var p in obj.plugins) {
203
- if (typeof obj.plugins[p][hookName] == 'function') {
203
+ if (typeof obj.plugins[p].on_device_header === "function" && typeof obj.plugins[p].on_device_page === "function") {
204
try {
205
- panel[p].header = obj.plugins[p].on_device_header();
206
- panel[p].content = obj.plugins[p].on_device_page();
205
+ panel[p] = {
206
+ header: obj.plugins[p].on_device_header(),
207
+ content: obj.plugins[p].on_device_page()
208
+ };
209
} catch (e) {
210
console.log("Error occurred while getting plugin views " + p + ':' + ' (' + e + ')');
211
}