So there are calls to <code>applySharedObject</code> to apply <code>rootId</code> and <code>data</code> to the components, before <code>updateLegend</code> gets called. This ensures that the legend component is added and the rootId and data is applied to the legend.