Fix possible soft crash from a race condition in space hierarchies (#9254)
Fix possible soft crash from a race condition in space hierarchies (#9254)

* Fix possible soft crash from a race condition in space hierarchies

* Improve typing
matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk