Skip to content
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

fix(http): Fixes Stream Bug #2522

Open
wants to merge 27 commits into
base: v2
Choose a base branch
from
Open

fix(http): Fixes Stream Bug #2522

wants to merge 27 commits into from

Conversation

adrieljss
Copy link
Contributor

@adrieljss adrieljss commented Mar 12, 2025

The problem was that the stream while sending was blocking the await function, not returning ReadableStream and the headers after sending.

This was fixed by (kind of) bringing back the fetch_read_body, I actually wanted to name it fetch_stream_body, but I don't know how to set up the permissions.

On ReadableStream start, it will call a different function (fetch_read_body) as to not block the return of the headers on fetch_send.

Fixes #2479 (comment)

@amrbashir

@adrieljss adrieljss requested a review from a team as a code owner March 12, 2025 02:05
@amrbashir
Copy link
Member

Can you please fix the conflicts?

And for future PRs, it is recommended not make PRs from the default branch as it most certainly will cause conflicts. You should always make a new branch for each PR.

@adrieljss
Copy link
Contributor Author

adrieljss commented Mar 12, 2025

Whoops
sorry I didn't know, I will resolve them soon. Thank you for the tip👍.

Copy link
Contributor

Package Changes Through ea012c1

There are 2 changes which include http with minor, http-js with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.21 2.0.22
api-example-js 2.0.17 2.0.18
http 2.4.0 2.5.0
http-js 2.4.0 2.5.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Comment on lines +362 to +367
#[command]
pub async fn fetch_read_body<R: Runtime>(
webview: Webview<R>,
rid: ResourceId,
stream_channel: Channel<tauri::ipc::InvokeResponseBody>,
) -> crate::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this command below fetch_send so it matches the order they are called on the JS side

@@ -370,7 +359,31 @@ pub fn fetch_cancel<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> crate::
Ok(())
}

#[tauri::command]
#[command]
pub async fn fetch_read_body<R: Runtime>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs to be add in lib.rs

@amrbashir
Copy link
Member

Also you need to run pnpm build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants