You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.9 KiB
Markdown
51 lines
1.9 KiB
Markdown
+++
|
|
title = "Set up ui/Cargo.toml with Yew/Wasm dependencies (yew, yew-router, gloo, wasm-bindgen, serde, etc.)"
|
|
priority = 8
|
|
status = "done"
|
|
ticket_type = "task"
|
|
dependencies = ["166996"]
|
|
+++
|
|
<context>
|
|
The `quotesdb` UI is a Yew (Rust → Wasm) single-page app compiled by Trunk and hosted on Cloudflare Pages. It communicates with the backend API via `fetch` calls. Source lives in `src/bin/ui/`. Run with `trunk serve` for local development.
|
|
|
|
TRIAGE resolved (ticket 166996): use yew = "0.22", yew-router = "0.19", wasm-bindgen = "0.2" (compatible with wasm-bindgen-cli 0.2.108 in the Nix dev shell).
|
|
</context>
|
|
|
|
<goal>
|
|
Add UI-side Yew/Wasm dependencies to `Cargo.toml` under `[target.'cfg(target_arch = "wasm32")'.dependencies]`. Use the following pinned versions:
|
|
|
|
- `yew = "0.22"` (latest stable: 0.22.1)
|
|
- `yew-router = "0.19"` (latest stable: 0.19.0, requires yew ^0.22.0)
|
|
- `gloo` — timers and fetch utilities for Yew
|
|
- `wasm-bindgen = "0.2"` (compatible with nix-shell wasm-bindgen-cli 0.2.108)
|
|
- `web-sys` — browser API bindings
|
|
- `serde` with `derive` feature
|
|
- `serde_json`
|
|
- `wasm-bindgen-futures` — for async fetch in Wasm
|
|
|
|
Also add `serde` and `serde_json` to `[dependencies]` (non-target-scoped) so shared lib types can use derive macros on both targets.
|
|
</goal>
|
|
|
|
<constraints>
|
|
- All UI-only dependencies must be scoped to the wasm32 target — they must not appear in host builds.
|
|
- `wasm-bindgen` version must match the `wasm-bindgen-cli` version in the Nix dev shell (currently 0.2.108).
|
|
- `serde` and `serde_json` are needed on both targets for shared types — add to `[dependencies]` not the wasm target section.
|
|
</constraints>
|
|
|
|
<skills>
|
|
Use `superpowers:verification-before-completion` — run `trunk build` to confirm WASM compilation succeeds.
|
|
</skills>
|
|
|
|
<validation>
|
|
From the `quotesdb/` directory:
|
|
|
|
```sh
|
|
cargo fmt
|
|
cargo check
|
|
trunk build
|
|
```
|
|
</validation>
|
|
|
|
<commit>
|
|
`chore(quotesdb): set up ui Cargo dependencies for Yew/Wasm`
|
|
</commit> |