NSOutlineView doesn't change height when expanded in SwiftUI

I have wrapped an NSOutlineView with NSViewRepresentable which works great. The problem is that when an item is expanded, the outline view doesn't change height and the animation doesn't work properly (see gif below). When I put the outline view in an NSScrollView, it works correctly, but I need to be able to put multiple outline views within a single SwiftUI scrollview.

struct Test: View {
    var body: some View {
        ScrollView {
            SwiftUiOutline()
            // Ultimately I need multiple outline views here
        }
    }
}
struct SwiftUiOutline: NSViewRepresentable {
    func makeNSView(context: Context) -> NSOutlineView {
        let view = NSOutlineView()

        // Outline view is set up here, and connected to the coordinator delegate

        return view
    }

    class Coordinator: CustomOutlineViewController {
        // The coordinator handles all the outline view delegation, etc.
    }

    // ...
}

The problem:

How it should work:

NSOutlineView doesn't change height when expanded in SwiftUI
 
 
Q