Skip to content

Commit df7880a

Browse files
Copilotgfauredev
andcommitted
Replace IndexedDB boilerplate with rexie, fix warnings, use use_resource for storage loading
Co-authored-by: gfauredev <19304085+gfauredev@users.noreply.github.com>
1 parent e5c524b commit df7880a

4 files changed

Lines changed: 109 additions & 166 deletions

File tree

Cargo.lock

Lines changed: 27 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ log = "0.4"
1818
web-sys = { version = "0.3", features = [
1919
"Window", "Storage", "Navigator",
2020
"ServiceWorkerContainer", "ServiceWorkerRegistration",
21-
"IdbFactory", "IdbDatabase", "IdbOpenDbRequest", "IdbRequest",
22-
"IdbTransaction", "IdbTransactionMode", "IdbObjectStore",
23-
"IdbObjectStoreParameters", "DomStringList",
2421
"Request", "RequestInit", "Response",
2522
] }
2623
wasm-bindgen = "0.2"
2724
wasm-bindgen-futures = "0.4"
2825
js-sys = "0.3"
2926
serde-wasm-bindgen = "0.6"
30-
futures-channel = "0.3"
3127
gloo-timers = "0.3"
28+
rexie = "0.6"
3229

3330
[[bin]]
3431
name = "log-workout"

src/services/exercise_db.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use dioxus::prelude::*;
22
use crate::models::Exercise;
33

4+
#[cfg(target_arch = "wasm32")]
45
const EXERCISES_JSON_URL: &str = "https://raw.githubusercontent.com/yuhonas/free-exercise-db/main/dist/exercises.json";
56

67
/// Provide the exercises signal in the Dioxus context.
@@ -18,6 +19,7 @@ pub fn use_exercises() -> Signal<Vec<Exercise>> {
1819
use_context::<Signal<Vec<Exercise>>>()
1920
}
2021

22+
#[allow(unused_mut, unused_variables)]
2123
async fn load_exercises(mut sig: Signal<Vec<Exercise>>) {
2224
// 1. Try IndexedDB
2325
#[cfg(target_arch = "wasm32")]

0 commit comments

Comments
 (0)