Skip to content

Commit 5a79ae3

Browse files
authored
Merge pull request #95 from Kannen/main
update to dioxus 0.7.0
2 parents 8d5816e + e27c92c commit 5a79ae3

File tree

13 files changed

+58
-64
lines changed

13 files changed

+58
-64
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ dioxus-util = { path = "packages/util", version = "0.1.0-alpha.1" }
2626
dioxus-window = { path = "packages/window", version = "0.1.0-alpha.1" }
2727

2828
# Dioxus
29-
dioxus = "0.6.0"
30-
dioxus-signals = "0.6.0"
31-
dioxus-desktop = "0.6.0"
32-
dioxus-config-macro = "0.6.0"
29+
dioxus = "0.7.0"
30+
dioxus-signals = "0.7.0"
31+
dioxus-desktop = "0.7.0"
32+
dioxus-config-macro = "0.7.0"
3333

3434
# Deps
3535
cfg-if = "1.0.0"
36-
tokio = "1.43.0"
36+
tokio = "1.48.0"
3737
futures = "0.3.31"
3838
futures-util = "0.3.31"
3939

packages/geolocation/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cfg_if::cfg_if! {
88
pub use self::core::*;
99
pub use self::use_geolocation::*;
1010
}
11+
1112
else {
1213
compile_error!("the `geolocation` feature is only available on wasm and windows targets");
1314
}

packages/geolocation/src/use_geolocation.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
use super::core::{Error, Event, Geocoordinates, Geolocator, PowerMode, Status};
44
use dioxus::{
55
prelude::{
6-
ReadOnlySignal, Signal, UnboundedReceiver, provide_context, try_consume_context,
7-
use_coroutine, use_hook, use_signal,
6+
ReadSignal, Signal, UnboundedReceiver, provide_context, try_consume_context, use_coroutine,
7+
use_hook, use_signal,
88
},
9-
signals::{Readable, Writable},
9+
signals::{ReadableExt, WritableExt},
1010
};
1111
use futures_util::stream::StreamExt;
1212
use std::sync::Once;
1313

1414
static INIT: Once = Once::new();
1515

1616
/// Provides the latest geocoordinates. Good for navigation-type apps.
17-
pub fn use_geolocation() -> ReadOnlySignal<Result<Geocoordinates, Error>> {
17+
pub fn use_geolocation() -> ReadSignal<Result<Geocoordinates, Error>> {
1818
// Store the coords
1919
let mut coords: Signal<Result<Geocoordinates, Error>> =
2020
use_signal(|| Err(Error::NotInitialized));
@@ -52,7 +52,7 @@ pub fn use_geolocation() -> ReadOnlySignal<Result<Geocoordinates, Error>> {
5252
}
5353
}
5454

55-
use_hook(|| ReadOnlySignal::new(coords))
55+
use_hook(|| ReadSignal::new(coords))
5656
}
5757

5858
/// Must be called before any use of the geolocation abstraction.

packages/notification/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::{
88
fmt::{self, Display},
99
path::{Path, PathBuf},
1010
};
11-
1211
/// Provides a builder API and contains relevant notification info.
1312
///
1413
/// # Examples

packages/storage/src/client_storage/memory.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use std::ops::{Deref, DerefMut};
55
use std::rc::Rc;
66
use std::sync::Arc;
77

8+
use dioxus::core::{consume_context_from_scope, provide_root_context};
9+
810
use crate::StorageBacking;
911

1012
#[derive(Clone)]
@@ -42,15 +44,14 @@ impl SessionStore {
4244

4345
/// Get the current session store from the root context, or create a new one if it doesn't exist.
4446
fn get_current_session() -> Self {
45-
dioxus::prelude::consume_context_from_scope::<Self>(dioxus::prelude::ScopeId::ROOT)
46-
.map_or_else(
47-
|| {
48-
let session = Self::new();
49-
dioxus::prelude::provide_root_context(session.clone());
50-
session
51-
},
52-
|s| s,
53-
)
47+
consume_context_from_scope::<Self>(dioxus::prelude::ScopeId::ROOT).map_or_else(
48+
|| {
49+
let session = Self::new();
50+
provide_root_context(session.clone());
51+
session
52+
},
53+
|s| s,
54+
)
5455
}
5556
}
5657

packages/storage/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ mod client_storage;
3030
mod persistence;
3131

3232
pub use client_storage::{LocalStorage, SessionStorage};
33+
use dioxus::core::{ReactiveContext, current_scope_id, generation, needs_update};
3334
use dioxus::logger::tracing::trace;
3435
use futures_util::stream::StreamExt;
3536
pub use persistence::{
@@ -401,10 +402,7 @@ where
401402
pub fn new(key: S::Key, data: T) -> Self {
402403
Self {
403404
key,
404-
data: Signal::new_in_scope(
405-
data,
406-
current_scope_id().expect("must be called from inside of the dioxus context"),
407-
),
405+
data: Signal::new_in_scope(data, current_scope_id()),
408406
}
409407
}
410408
}

packages/time/src/debounce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{TimeoutHandle, UseTimeout, use_timeout};
22
use dioxus::{
33
dioxus_core::SpawnIfAsync,
44
hooks::use_signal,
5-
signals::{Signal, Writable},
5+
signals::{Signal, WritableExt as _},
66
};
77
use std::time::Duration;
88

packages/time/src/interval.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use dioxus::{
2+
core::Task,
23
dioxus_core::SpawnIfAsync,
3-
prelude::{Callback, Task, Writable, spawn, use_hook},
4-
signals::Signal,
4+
prelude::{Callback, spawn, use_hook},
5+
signals::{Signal, WritableExt as _},
56
};
67
use std::time::Duration;
78

@@ -52,7 +53,7 @@ impl UseInterval {
5253
/// let mut time_elapsed = use_signal(|| 0);
5354
/// // Create an interval that increases the time elapsed signal by one every second.
5455
/// use_interval(Duration::from_secs(1), move |()| time_elapsed += 1);
55-
///
56+
///
5657
/// rsx! {
5758
/// "It has been {time_elapsed} since the app started."
5859
/// }
@@ -70,7 +71,7 @@ impl UseInterval {
7071
/// fn App() -> Element {
7172
/// let mut time_elapsed = use_signal(|| 0);
7273
/// let mut interval = use_interval(Duration::from_secs(1), move |()| time_elapsed += 1);
73-
///
74+
///
7475
/// rsx! {
7576
/// "It has been {time_elapsed} since the app started."
7677
/// button {
@@ -99,7 +100,7 @@ impl UseInterval {
99100
/// tokio::time::sleep(Duration::from_secs(1)).await;
100101
/// println!("Done!");
101102
/// });
102-
///
103+
///
103104
/// rsx! {
104105
/// "It has been {time_elapsed} since the app started."
105106
/// }

packages/time/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub use timeout::{TimeoutHandle, UseTimeout, use_timeout};
3030
/// #[component]
3131
/// pub fn App() -> Element {
3232
/// let mut has_slept = use_signal(|| false);
33-
///
33+
///
3434
/// use_effect(move || {
3535
/// spawn(async move {
3636
/// dioxus_time::sleep(Duration::from_secs(3)).await;

packages/time/src/timeout.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use dioxus::{
2+
core::Task,
23
dioxus_core::SpawnIfAsync,
3-
prelude::{Callback, Task, spawn, use_hook},
4+
prelude::{Callback, spawn, use_hook},
45
signals::Signal,
56
};
67
use futures::{SinkExt, StreamExt, channel::mpsc};
@@ -91,7 +92,7 @@ impl TimeoutHandle {
9192
/// // Create a timeout for two seconds.
9293
/// // Once triggered, this timeout will print "timeout called" after two seconds.
9394
/// let timeout = use_timeout(Duration::from_secs(2), |()| println!("timeout called"));
94-
///
95+
///
9596
/// rsx! {
9697
/// button {
9798
/// onclick: move |_| {
@@ -118,7 +119,7 @@ impl TimeoutHandle {
118119
/// current_timeout.set(None);
119120
/// println!("timeout called");
120121
/// });
121-
///
122+
///
122123
/// rsx! {
123124
/// button {
124125
/// onclick: move |_| {
@@ -153,7 +154,7 @@ impl TimeoutHandle {
153154
/// tokio::time::sleep(Duration::from_secs(2)).await;
154155
/// println!("Timeout after four total seconds.");
155156
/// });
156-
///
157+
///
157158
/// rsx! {
158159
/// button {
159160
/// onclick: move |_| {

0 commit comments

Comments
 (0)