-
Notifications
You must be signed in to change notification settings - Fork 433
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
Progress Bar finishes prematurely #884
Comments
@tropperstyle thank you for opening this issue. In the time since you've opened it, this project has undergone significant structural changes, and files have been renamed. The "here" that you link to in your description references a file that no longer exists. The code referenced by Could you re-share the line number that you've prefixed with |
Sure, I also updated my previous comment: https://github.com/hotwired/turbo/blob/v7.3.0/src/http/fetch_request.ts#L134 |
Closes [hotwired#884] Despite the fact that `Visit` and `FrameController` are `FetchRequest` delegate classes that implement their delegate methods asynchronously on success ([Visit.requestSucceededWithResponse][] and [FrameController.requestSucceededWithResponse][]) and on failure ([Visit.requestFailedWithResponse][]) and [FrameController.requestFailedWithResponse][]), the `async FetchRequest.receive` method doesn't use the `await` keyword to wait for those delegates to finish handling their callbacks. This commit adds those `await` clauses. [Visit.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L297 [FrameController.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L210 [Visit.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L311 [FrameController.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L215 [hotwired#884]: hotwired#884
Thank you! I've opened #1039. I'd appreciate review. Could we move conversation to that PR? |
Closes [hotwired#884] Despite the fact that `Visit` and `FrameController` are `FetchRequest` delegate classes that implement their delegate methods asynchronously on success ([Visit.requestSucceededWithResponse][] and [FrameController.requestSucceededWithResponse][]) and on failure ([Visit.requestFailedWithResponse][]) and [FrameController.requestFailedWithResponse][]), the `async FetchRequest.receive` method doesn't use the `await` keyword to wait for those delegates to finish handling their callbacks. This commit adds those `await` clauses. [Visit.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L297 [FrameController.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L210 [Visit.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L311 [FrameController.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L215 [hotwired#884]: hotwired#884
Closes [hotwired#884] Despite the fact that `Visit` and `FrameController` are `FetchRequest` delegate classes that implement their delegate methods asynchronously on success ([Visit.requestSucceededWithResponse][] and [FrameController.requestSucceededWithResponse][]) and on failure ([Visit.requestFailedWithResponse][]) and [FrameController.requestFailedWithResponse][]), the `async FetchRequest.receive` method doesn't use the `await` keyword to wait for those delegates to finish handling their callbacks. This commit adds those `await` clauses. [Visit.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L297 [FrameController.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L210 [Visit.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L311 [FrameController.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L215 [hotwired#884]: hotwired#884
Closes [hotwired#884] Despite the fact that `Visit` and `FrameController` are `FetchRequest` delegate classes that implement their delegate methods asynchronously on success ([Visit.requestSucceededWithResponse][] and [FrameController.requestSucceededWithResponse][]) and on failure ([Visit.requestFailedWithResponse][]) and [FrameController.requestFailedWithResponse][]), the `async FetchRequest.receive` method doesn't use the `await` keyword to wait for those delegates to finish handling their callbacks. This commit adds those `await` clauses. [Visit.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L297 [FrameController.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L210 [Visit.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L311 [FrameController.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L215 [hotwired#884]: hotwired#884
Closes [hotwired#884] Despite the fact that `Visit` and `FrameController` are `FetchRequest` delegate classes that implement their delegate methods asynchronously on success ([Visit.requestSucceededWithResponse][] and [FrameController.requestSucceededWithResponse][]) and on failure ([Visit.requestFailedWithResponse][]) and [FrameController.requestFailedWithResponse][]), the `async FetchRequest.receive` method doesn't use the `await` keyword to wait for those delegates to finish handling their callbacks. This commit adds those `await` clauses. [Visit.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L297 [FrameController.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L210 [Visit.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L311 [FrameController.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L215 [hotwired#884]: hotwired#884
Closes [hotwired#884] Despite the fact that `Visit` and `FrameController` are `FetchRequest` delegate classes that implement their delegate methods asynchronously on success ([Visit.requestSucceededWithResponse][] and [FrameController.requestSucceededWithResponse][]) and on failure ([Visit.requestFailedWithResponse][]) and [FrameController.requestFailedWithResponse][]), the `async FetchRequest.receive` method doesn't use the `await` keyword to wait for those delegates to finish handling their callbacks. This commit adds those `await` clauses. [Visit.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L297 [FrameController.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L210 [Visit.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L311 [FrameController.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L215 [hotwired#884]: hotwired#884
Closes [hotwired#884] Despite the fact that `Visit` and `FrameController` are `FetchRequest` delegate classes that implement their delegate methods asynchronously on success ([Visit.requestSucceededWithResponse][] and [FrameController.requestSucceededWithResponse][]) and on failure ([Visit.requestFailedWithResponse][]) and [FrameController.requestFailedWithResponse][]), the `async FetchRequest.receive` method doesn't use the `await` keyword to wait for those delegates to finish handling their callbacks. This commit adds those `await` clauses. [Visit.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L297 [FrameController.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L210 [Visit.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L311 [FrameController.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L215 [hotwired#884]: hotwired#884
@tropperstyle I've opened #1039, incorporated your suggestions, and resolved the failing test. Could you review that PR and share whether or not the changes resolve your issue locally? |
Closes [hotwired#884] Despite the fact that `Visit` and `FrameController` are `FetchRequest` delegate classes that implement their delegate methods asynchronously on success ([Visit.requestSucceededWithResponse][] and [FrameController.requestSucceededWithResponse][]) and on failure ([Visit.requestFailedWithResponse][]) and [FrameController.requestFailedWithResponse][]), the `async FetchRequest.receive` method doesn't use the `await` keyword to wait for those delegates to finish handling their callbacks. This commit adds those `await` clauses. [Visit.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L297 [FrameController.requestSucceededWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L210 [Visit.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/drive/visit.js#L311 [FrameController.requestFailedWithResponse]: https://github.com/hotwired/turbo/blob/c207f5b25758e4a084e8ae42e49712b91cf37114/src/core/frames/frame_controller.js#L215 [hotwired#884]: hotwired#884
I have backend server that streams responses to the client as soon as possible, so the browser can start painting while a data is still pending.
So even if
await fetch()
returns, we still only have the response headers, but are still waiting for the body to complete. Turbo's progress bar is really jarring in this case. It quickly jumps to 100%, then there is a long delay before the page actually navigates.I added
await
here which fixes my use-case, but it introduced a failing test which I'm not sure what to do with:The text was updated successfully, but these errors were encountered: