The absence of a “slot” instance in the collapsed variant is the reason for resetting the override. You need to make sure that the structure of your variants and the layer names are identical.
Solution:
- Place a “slot” instance in a auto layout frame (let’s call it “content”, for example).
- Apply the component’s instance swap property to the “slot” instance.
- Then control the visibility of the “content” frame in your variants.