Creating custom node breaks ui_button

Hi! I have an issue - whenever I add a custom node to my node-red, the ui_buttons that I have on my dashboard lose their input "port". Trying to deploy the flows would yield that those elements are not properly configured.

At first I thought -- fair enough, I probably broke it somehow with my custom code, but now I have cut my custom object down to the lower-case example component and the same thing still happens.

How to debug? Thanks for hints! :pray:

Please check both the Node-RED log and your browser console for any errors and let us know.

This kind of thing can happen due to poorly isolated code in a node - I know because I've done it myself!

These days, I try to remember to wrap my code in an IIFE:

....

<script type="text/javascript">
;(function () { // Isolate the front-end code
    'use strict'

    RED.nodes.registerType('moment',{

        // ....

    }); // ---- end of RED.nodes.registerType ---- //
})()
</script>
1 Like

Thanks for the hint and sorry for the late reply!

Finally digged into making it work today, and although it took me way too long trial-and-error, I finally figured out that it somehow was caused by having node-red-dashboard as well as node-red-contrib-ui both installed (both register ui_button component).

I am not sure how exactly my custom component broke it, but once I finally removed node-red-contrib-ui, everything started to work as expected :tada:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.