Component replacement does not adjust the height

Hey folks, I have a component called Section and this component has an image, which is a component, and a grouped text.

Issue: When I create an instance of the Section component and replace the image component to use another one I would expect the Section component to fit the height of the new image component, but that does not happen.

Link to the Figma file: https://www.figma.com/file/a1BQbulSnwJekRVTwGbPg7/Untitled?node-id=0%3A1

I edited your file and now instance swap works as expected. I added Auto Layout to each of the components, and wrapped the nested content in a frame with a fixed width and height.

I’m having this problem, it would be good to have a clarification as to exactly how this was resolved. I have components that work exactly as expected except when I use them to replace other components, then hell breaks loose…
I’m finding the behaviour completely inconsistent which makes it very hard to troubleshoot. In some cases, the component is squashed in others, while swapping from exactly the same one it works…