Fix potential race condition with request ID in dev mode (#84532)
In development mode, the request ID needs to be available before the bootstrap script executes and triggers hydration. Previously, the request ID was set inline with the flight data stream in a script tag that was inserted after the bootstrap script, which could lead to a race condition where `self.__next_r` was accessed before it was defined. With this PR, we're moving the request ID initialization to `bootstrapScriptContent`, which is inserted as a script tag by React immediately before the bootstrap script. This ensures that the request ID is always defined when the bootstrap script runs. I wasn't actually able to reproduce the issue, so I also couldn't add a test for it. But we did receive reports from users that this was happening, which is plausible given the previous script order.
Showing
Please
register
or
sign in
to comment