nusmods
nusmods copied to clipboard
Catch and ignore Disqus errors
Disqus's component is rather buggy, causing quite a few errors. We should try to catch Disqus errors and render an error component -- maybe wrap the Disqus component in an ErrorBoundary?
Steps to reproduce
- Open a module's page, e.g. https://nusmods.com/modules/PS3249/singapores-foreign-policy
- In the Disqus widget, click "NUSMods", located to the left of "Disqus Privacy Policy".

- An error will be logged to the console, and the page will freeze.
Context
Sentry Issue: V3-3CJ (internal only; external link)
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'HTMLDivElement'
| property '__reactFiber$6cpk6wi09gs' -> object with constructor 'Du'
--- property 'stateNode' closes the circle
at JSON.stringify (<anonymous>)
at b.Channel.h.sendMessage (/embed.js:44:18771)
at e.<anonymous> (/embed.js:45:2483)
at e.<anonymous> (/embed.js:44:16158)
at e.<anonymous> (/embed.js:44:15677)
...
(7 additional frame(s) were not displayed)
Hi, following steps 1 and 2 does result in errors in the console. However, the errors are not related to TypeError: Converting circular structure to JSON. Also, the page did not freeze.