Critical: Concurrent renders
CosticaPuntaru opened this issue · 4 comments
on the server side there can be more then one requests at the same time being processed,
the const portals = [];
at the file level will be shared between requests, and the output won't be what is expected.
in order to work properly the portals array needs to be sandboxed per request.
@CosticaPuntaru That's a valid point, thanks. It would be better when the first call of appendUniversalPortals
would create a scope limited to the single request and then inject the markup.
I'm a fan of this, but perhaps add a big fat disclaimer not to use this until this issue is fixed? Only saw this by chance and it's a dealbreaker tbh.
@MioQuispe Sure, thanks.
@MichalZalecki Maybe this is helpful:
https://jeremygayed.com/making-head-tag-management-thread-safe-with-react-head-323654170b45
https://github.com/tizmagik/react-head
I would help you out otherwise but I'm suuuper busy atm