Text input node in a subflow crashes Layout Order Editor
Current Behavior
Using a text input node in a subflow crashes Layout Order Editor.
Uncaught TypeError: Cannot read properties of undefined (reading 'type')
at <anonymous>:753:84
at Array.filter (<anonymous>)
at <anonymous>:753:63
at Object.eachNode (red.min.js?v=:16:57181)
at Object.eachNode (red.min.js?v=:16:87852)
at buildLayoutOrderEditor (<anonymous>:747:19)
at refreshSidebarEditors (<anonymous>:905:13)
at later (<anonymous>:44:38)
I dug a bit into it and I think the line to blame is this one:
In my case, when looking into the JS object and also the exported flow JSON env on the subflow does not have any ui property.
So, one way to fix this, could be to switch the comparisons from:
subflowDef.env.filter(env => env.ui.type === 'conf-types' && env.type === 'ui-group')
to
subflowDef.env.filter(env => env.type === 'ui-group' && env.ui.type === 'conf-types')
Expected Behavior
After adding a text input node in a sub flow the layout order editor is still functional.
Steps To Reproduce
- Create a page
- Create a subflow containing a text input node
- Add the sublfow to the page
- See the contents of the Dashboard 2.0 Layout Order Editor disappear
Environment
- Dashboard version: 1.4.1
- Node-RED version: 3.1.3
- Node.js version: 16.20.2
- npm version: 8.19.4
- Platform/OS: macOS Ventura 13.4.1 (22F82)
- Browser: ARc Version 1.35.0 (47750) Chromium Engine Version 123.0.6312.59
Have you provided an initial effort estimate for this issue?
I am not a FlowFuse team member
fyi @Steve-Mcl
Using node-red 4.0.0 Beta 1 I am not able to replicate the issue. I thought it was necessary to use v4 when using dashboard nodes in a subflow.
@colinl Thanks for the hint. Would you please point me to the documentation on this?
@colinl I think I found what you meant: https://dashboard.flowfuse.com/user/subflows.html#configuring-subflows-for-dashboard-2-0
But luckily my use case does not need configurable ui-groups; the group where the text input should be displayed in is static.
In any way, I guess, the bug mentioned above is worth fixing.
@phfeustel Node-RED 4.0+ is needed for Dashboard 2.0 nodes to work in a subflow - in all occasions, not just when using a group.
If you're hitting this problem in Node-RED 4.0+, then please let us know.
@joepavitt thanks for the feedback.
I did a quick retest on Node-RED: 4.0.0-beta.: Same issue; I think the comparison code from above is just bugged and needs switching the conditions.
Just checking, did you restart node red? As I said, I don't see the issue.
Yes, I'm using node red in docker: Stop the 3.1.3; pulled the 4.0.0-beta image; started this and then did a full page refresh in the browser.
@joepavitt Any update or ETA?
As a side node: I patched the line above in my local installation and it is running now for 3 weeks stable. Should I open an pull request?
Should I open an pull request?
please, PRs are always welcome, never need to ask for permission :)
Closed by https://github.com/FlowFuse/node-red-dashboard/pull/800