Moved from the NR v5 thread as I think this might be a bug from before then?
Ah, another sidebar issue?
UIBUILDER has the uib-sidebar node that creates a custom sidebar - in NR5, unless I'm missing something, there doesn't appear to be a way to get to that sidebar any more. It was working fine before and, I think, was working in the beta.
Hmm, actually, it might be a bug in the uib-sidebar node.
So this actually appears to be a bug in core - I think.
function w(a) {
return N.primary.tabs.contains(a)
}
Sorry, I can't find this in the actual node-red code, that is how it appears in the browser when viewing the Editor page.
In my uib-sidebar node, I watch for an instance of the node being added and, for the first instance only, try to add the sidebar tab. But first, I test for whether it already exists using:
RED.events.on('nodes:add', function(node) {
if (node.type === moduleName) {
// console.log(`๐๐[uib-sidebar] Node added: ${node.id}`, node.html)
window['uibSidebarNodeCount']++
console.info(`๐๐[uib-sidebar] Node count: ${window['uibSidebarNodeCount']}`)
// When the first uib-sidebar node is added ...
if (window['uibSidebarNodeCount'] === 1) {
log('๐๐[uib-sidebar] FIRST uib-sidebar added - ADDING SIDEBAR')
let uibSb = false
try {
uibSb = RED.sidebar.containsTab('uibuilder-sidebar-ui')
} catch (e) {
// Ignore - this just means the sidebar tab doesn't exist yet
console.error('๐๐[uib-sidebar] Error checking for existing sidebar tab:', e)
}
// Add the sidebar tab
if (!uibSb) {
RED.sidebar.addTab({
id: 'uibuilder-sidebar-ui',
label: 'uib UI',
name: 'UIBUILDER Sidebar UI',
content: sbMasterEl,
// toolbar: uiComponents.footer,
enableOnEdit: true,
iconClass: 'fa fa-globe uib-blue',
})
}
}
...
The line:
uibSb = RED.sidebar.containsTab('uibuilder-sidebar-ui')
Produces the error:
VM4018:127 ๐๐[uib-sidebar] Error checking for existing sidebar tab: TypeError: Cannot read properties of undefined (reading 'contains')
at Object.w [as containsTab] (red.min.js?v=358a4182b458:97:106251)
at <anonymous>:124:41
at Object.k [as emit] (red.min.js?v=358a4182b458:16:23144)
at h (red.min.js?v=358a4182b458:18:16973)
at Object.nt [as import] (red.min.js?v=358a4182b458:18:44991)
at Object.success (red.min.js?v=358a4182b458:16:3526)
at c (vendor.js?v=358a4182b458:2:25304)
at Object.fireWith [as resolveWith] (vendor.js?v=358a4182b458:2:26053)
at l (vendor.js?v=358a4182b458:2:77782)
at XMLHttpRequest.<anonymous> (vendor.js?v=358a4182b458:2:80265)
When tracing the problem, I find the error is generated in that initial code I posted. It turns out that the tabs property is undefined.
I think this is probably a bug in that code and it probably should be something like:
function w(a) {
return N.primary?.tabs?.contains(a) ?? false
}