-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add async
option for streaming
#352
base: main
Are you sure you want to change the base?
Conversation
MDN says I think I understand the intent, but it would be probably better if you can first demonstrate how current SSR streaming is inconvenient without this flag. Actually I've been wondering about a similar issue when running |
For info I don't think adding complexity to speed up something that is dev only is a good thing. You will never be able to test prod streaming in a dev env. I'm not opposed to this, but we should have strong evidence that this required for some SSR/streaming setup to be added |
It is a **module script & it outlines the behaviour for async module scripts in the "Attributes" section
& Im not "trying" ... It is working as per the spec/expected |
This is not to "speed up" anything , it is a requirement for streaming to work as expected in DEV, Im supprised at the level of negativity/misdirection, my simple PR has attracted ... |
Sorry if you felt that way. I didn't mean that at all and thanks for the PR to bring this up. I didn't share previously but I had this PR on Remix in mind remix-run/remix#7842, which not only added I'll check again later, but again it would be still helpful if you can provide a demo app to show the difference of this change. |
I created a simple example here https://github.com/hi-ogawa/reproductions/tree/main/vite-react-streaming-preamble-race-condition-352 and my streaming server setup looks like this. I added I recognize this as a general issue and the solution is desired, but I'm not sure what's the best way and whether it can/should be fixed on framework/integration side or vite plugin side. Again It's totally possible that your have a ssr streaming setup totally different from what I have imagined, so I would appreciate if you can provide an example. |
Oh, wait, am I totally misdirecting? Looking back your description, it says about the execution of preamble and you are not actually concerned with preamble race condition with bootstrap scripts? If so, I apologize and we would need more context on your wish of "script will be executed as soon as it is available" and if there's any critical reason that's desired. |
Description
Add
async
to options, so that the script will be executed as soon as it is available.This allows our the client code to run ASAP, while the document is streaming.
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).