I found another workaround.
First I register all the root contributions in a static contributions keeper, which just has a list of all the current root contributions. In the updateView
function og the nodes that need references, I can locally check if the references are set up. If they are not set up, I can call the static contribution keeper, and ask it to call the set-up method for all the root contributions that are registered.
Note that the contributions should ideally be deleted when the user deletes them. Although this is not trivial, this question notes that you can use generateScript
to check in the currently active contributions. The method is called when all nodes are green and the user presses either save or play. By having a ContributionKeeper.getInstance().checkIn(this)
in the root contribution, you can keep an updated list.