Sub components not unloaded / removed from RWS when replacing components which have sub components - scm
One answer
A replace operation will not cause a component to be removed from the workspace. If the replacing version of the parent component does not include a subcomponent that was under the original version of the parent component, and the subcomponent is not already in the workspace under another parent component, then the subcomponent will become a top-level component.
Imagine that you have top-level components A and B. You later decide to make B a subcomponent of A. Then you change your mind, so you replace A with the initial baseline of A. If B were removed with that replace operation, it would clearly be incorrect.
Since there are cases where the user would want the subcomponent to be removed, and other cases where he would not, RTC does the conservative thing and leaves the component in the workspace. The user can then remove that component, if desired.
Comments
I personally believe that the component should by default be automatically be removed from a workspace/stream if it is a sub-component that has been removed from its only parent component in the workspace/stream. My rationale is that the primary purpose of making a component a subcomponent of another component is to declare that this sub-component is required by its parent component, and if it is no longer needed by any parent component, then it should no longer be in the workspace/stream.
I have created a new enhancement request https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/447317 : "Provide warning if an orphaned component is being added to the top level component list of a workspace/stream"