How to debug a Brave freeze, collect logs? Browser console doesn't work if unresponsive

Using the following website Brave freezes stochastically (maybe about once every 100 clicks), becoming totally unresponsive. The only way to recover is to kill Brave entirely through SIGKILL (when it freezes it clocks 100% CPU usage).

This problem does not occur with other websites. Since I am a developer of this website, I would like to figure out what causes these freezes. But I have not been able to come up with a way to debug. Browser dev tools don’t help (as far as I know) since the whole browser becomes unusable.

Is there a way to collect logs in a way that doesn’t require Brave to be responsive? Write logs to a file? Any ideas would be much appreciated!

I’m not sure if this is a website bug or a Brave bug. The freezes don’t happen on Firefox, and only extremely rarely on Chrome (only spotted once).

OS: MacOS Big Sur 11.6
CPU: 2.2 GHz 6-Core Intel Core i7
Brave version: Release Notes V1.31.87 but applies generally