Nodes With States
A node has states if its behavior depends on the values of intern variables. For example, the state of a n-dimensional for loop is determined by the number of dimensions used.
If your node has states, save these state defining attributes by providing their values in a dict in JSON compatible format in the get_data() method and reload them in the set_data() method of the node (same for all the custom widget classes). This ensures that the node's state gets reinitialized correctly when loading a project or pasting copied components.
The special_actions dict as well as all inputs and outputs get saved and reloaded automatically as they are, so if you added some or removed some, you don't have to worry about that, you just need to reset your custom variables telling your object in which state it's currently in.
Example following soon.