Tab groups not hidden at first execution of node-red

I have a project with a single tab with several groups. By using buttons and an 'ui-control' node I can hide some of the groups and show some of them without problem. I also have an 'inject' node, configured to inject once, for initializing vars and to show/hide the groups at loading of node-red. The problem is that at first execution all the groups are shown ignoring the payload sent to the ui-control:
msg.payload = {
"group": {
"hide": [....],
"show": [....]
}
};
But the rest of the nodes of the flow are executed properly. If I click on the 'inject' node the complete execution is done. It seems that the payload sent ro the 'ui-control' node is ignored at load of node-red.
Any idea of how to solve this?

node-red version: 2.1.4
node.js version: 16.13.0
dashboard version: 3.1.0

Use a ui control node instead of an inject to initialise. That node fires on connection (note: there are 3 options in the ui control)

Now is working. Thanks a lot.