Skip to content

FR: UI notification when On Start or On Stop are modified (function node) #5436

@SindreLindahl

Description

@SindreLindahl

Background
Node-RED function nodes have separate tabs for "On Start" and "On Stop" where you can add code to run once on start/stop. Very useful feature! For example, setting up context once, and leave room in normal code tab for msg handling. However, this is rarely used and easily forgotten. The way node red compartmentalizes code means you never see the whole picture at the same time.

Problem
Forgetting to check/update this can cause some issues. You may forget that it is there, misunderstand normal code or even copy-paste to make a new function node, getting unwanted code you're not aware of. People have reportedly manually added comments on line 1 in "On Message" to notify about On Start/Stop usage for years 😄

Solution
Add some sort of notification to easily show user a function node has edited contents in On Start and/or On Stop tabs.
Not sure what is best here, but there may be several solutions:

  • highlight the entire tab
  • add a badge somewhere
  • a hint (similar to inject node, that shows up on the right side of node name text area)

Either way, I think it would be best to check if code was added to a tab, not just modified. Because you may remove the default comments, (setting the text empty) but still not want notification. At least no notification on empty text (in addition to default comments).

Discussion: https://discourse.nodered.org/t/notification-when-on-start-function-node-is-modified/100162

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions