After the RainbowKit update, this was broken and was detecting modal dismissal when the WalletConnect modal was opened.
To address this, I added some state that tracks whether the WalletConnect modal is open, and disabled the dismiss behavior while it's open.
Depends on D8252