mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-14 19:26:51 -04:00
Preferences merge with other tabs/windows and retry failed saves; web startup shows a Reload hint (#475, #476, #477) (#561)
* Preferences: saves merge with what another tab or window stored, and failed writes are retried (#475, #476) A save now writes only the values this instance changed since it last loaded or saved them over what storage holds (a three-way merge over the JSON tree; arrays are leaves), so a second browser tab no longer reverts the other's changes. The saved revision moves only when the write succeeds: a failure is retried after 2 s, doubling to 30 s (sooner after a newer change), with a status message on the first failure and a notice while it keeps failing. Shared by the desktop and web builds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Web: a startup that never gets going shows what may have failed and a Reload link (#477) When the .wasm fails to download or doesn't match the page, no Rust runs, so the loading page itself (CSS only, no script) adds the hint after 20 s. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
2868220032
commit
2628b0dd3d
7 files changed
+278
-16
No files matched your search
@@ -285,6 +285,7 @@ How the web shell (`apps/photocraft-web/src/web.rs`) differs from desktop:
|
||||
- **Open** uses `rfd::AsyncFileDialog`. The bytes arrive asynchronously in `Services::inbox`, which the app drains every frame.
|
||||
- **Save / Save As / Export** trigger a browser download of the encoded bytes. The shell does this with a Blob, an object URL and a temporary `<a download>`, all created from Rust. There is no save dialog, so the suggested name becomes the download name.
|
||||
- **Drag-and-drop:** `WebShell` takes the frame's `dropped_files` before the app sees them. It reads each file with `DroppedFile::bytes_async` and pushes the bytes into the inbox.
|
||||
- **Startup failures:** `index.html` shows "Loading PhotoCraft…" until the app removes it, or replaces it with the error when the web runner fails to start. If the `.wasm` never downloads or doesn't match the page's `.js` (a stale cached `index.html` after a deploy), no Rust runs at all, so the page itself (CSS only, no script) adds a hint with a Reload link after 20 seconds.
|
||||
- **No control server:** browsers can't listen on TCP. To automate the web build, drive headless Chrome with `--remote-debugging-port`. `Page.setInterceptFileChooserDialog` plus `DOM.setFileInputFiles` covers Open, `Input.dispatchDragEvent` with `files` covers drops, and `Browser.setDownloadBehavior` captures downloads.
|
||||
- Headless Chrome on macOS (`--headless=new --enable-unsafe-webgpu`) gets a real WebGPU adapter.
|
||||
|
||||
|
||||
Reference in new issue
Block a user