fix double serialize on invoke (#5639)

Co-authored-by: LucasJavaudin <lucas.javaudin@cyu.fr>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
LucasJavaudin 2022-11-20 14:20:09 +01:00 committed by GitHub
parent 168c3d0148
commit 677838ccfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch
---
Fixes a double serialization on the IPC.

View File

@ -193,7 +193,11 @@ impl<R: Runtime> InvokeResolver<R> {
F: Future<Output = Result<JsonValue, InvokeError>> + Send + 'static,
{
crate::async_runtime::spawn(async move {
Self::return_result(self.window, task.await.into(), self.callback, self.error)
let response = match task.await {
Ok(ok) => InvokeResponse::Ok(ok),
Err(err) => InvokeResponse::Err(err),
};
Self::return_result(self.window, response, self.callback, self.error)
});
}