chore(deps): upgrade wry from 0.45.0 to v0.52.0 (#4255)

* chore(deps): upgrade wry from 0.45.0 to v0.51.2

* Unwrap webview

* update tauri

* fix more versions

* switch to a single websocket per app to communicate edits in desktop

* use websockets on the ts side

* queue pending edits before the websocket connects

* fix decoding the websocket blobs in ts

* rebuild js

* fix clippy

* more sensible struct names

* allow http on android and require a key to match between the webview and native sides

* remove out.txt

* clippy

* small style changes

* More light cleanups

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-07-01 18:08:24 -07:00
1 parent 65dd1f1762
commit d5daf14c15
18 files changed
+1324 -1083

No files matched your search

+19 -10
View File
@@ -20,7 +20,7 @@ if (RawInterpreter !== undefined && RawInterpreter !== null) {
export class NativeInterpreter extends JSChannel_ {
intercept_link_redirects: boolean;
ipc: any;
editsPath: string;
edits: WebSocket;
eventsPath: string;
kickStylesheets: boolean;
queuedBytes: ArrayBuffer[] = [];
@@ -31,7 +31,7 @@ export class NativeInterpreter extends JSChannel_ {
constructor(editsPath: string, eventsPath: string) {
super();
this.editsPath = editsPath;
this.edits = new WebSocket(editsPath);
this.eventsPath = eventsPath;
this.kickStylesheets = false;
}
@@ -373,23 +373,32 @@ export class NativeInterpreter extends JSChannel_ {
if (headless) {
// @ts-ignore
this.run_from_bytes(bytes);
this.waitForRequest(headless);
this.markEditsFinished();
} else {
this.enqueueBytes(bytes);
requestAnimationFrame(() => {
this.flushQueuedBytes();
// With request animation frames, we use the next reqwest as a marker to know when the frame is done and it is safe to run effects
this.waitForRequest(headless);
this.markEditsFinished();
});
}
}
waitForRequest(headless: boolean) {
fetch(new Request(this.editsPath))
.then((response) => response.arrayBuffer())
.then((bytes) => {
this.rafEdits(headless, bytes);
});
this.edits.onmessage = (event) => {
const data = event.data;
if (data instanceof Blob) {
// If the data is a blob, we need to convert it to an ArrayBuffer
data.arrayBuffer().then((buffer) => {
this.rafEdits(headless, buffer);
});
}
};
}
markEditsFinished() {
// Send an empty ArrayBuffer to the edits websocket to signal that the edits are finished
// This is used to signal that the edits are done and the next request can be processed
this.edits.send(new ArrayBuffer(0));
}
kickAllStylesheetsOnPage() {