Sister PR to matrix-org/complement#666 Context: https://github.com/matrix-org/complement/issues/654#issuecomment-1746613495