Open wojtekmaj opened 5 months ago
Thanks for the issue!
I don't think you should use an announce in the render function, it has a side effect. I think you should put it inside an effect which wouldn't run on the server anyways. That, or put it in an interaction callback.
In addition, you may have this announced more times than you expect because you're relying on renders, which are not guaranteed and in React 18+ may actually run multiple times in their concurrent model. In an effect you can guard against extraneous calls.
Provide a general summary of the issue here
When announce() is used in render function in SSR, it triggers an error: "Uncaught Error: document is not defined".
๐ค Expected Behavior?
announce()
to abort if document is not defined๐ฏ Current Behavior
announce()
attempts to create div usingdocument.createElement
even in Node.js environment๐ Possible Solution
๐ฆ Context
No response
๐ฅ๏ธ Steps to Reproduce
Run the following component in SSR:
Version
3.34.1
What browsers are you seeing the problem on?
Other
If other, please specify.
Node.js
What operating system are you using?
macOS Ventura
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response