Skip to content

Commit

Permalink
use_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Jul 5, 2024
1 parent c1044f6 commit 4334f2c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl AppState {
{
// ... when [AppState::flake_url] changes.
let flake_url = self.flake_url.read().clone();
use_resource((&flake_url,), |(flake_url,)| async move {
use_resource(move || async move {
if let Some(flake_url) = flake_url {
let maybe_flake = self.flake_cache.read().get(&flake_url);
if let Some(cached_flake) = maybe_flake {
Expand All @@ -107,7 +107,7 @@ impl AppState {
});
// ... when refresh button is clicked.
let refresh = *self.flake_refresh.read();
use_resource((&refresh,), |(refresh,)| async move {
use_resource(move || async move {
let flake_url = self.flake_url.read().clone();
if let Some(flake_url) = flake_url {
let flake_url_2 = flake_url.clone();
Expand All @@ -131,7 +131,7 @@ impl AppState {
{
let nix_info = self.nix_info.read().clone();
let refresh = *self.health_checks_refresh.read();
use_resource((&nix_info, &refresh), |(nix_info, refresh)| async move {
use_resource(move || async move {
if let Some(nix_info) = nix_info.current_value().map(|x| {
x.as_ref()
.map_err(|e| Into::<SystemError>::into(e.to_string()))
Expand All @@ -150,7 +150,7 @@ impl AppState {
// Build `state.nix_info`
{
let refresh = *self.nix_info_refresh.read();
use_resource((&refresh,), |(refresh,)| async move {
use_resource(move || async move {
tracing::info!("Updating nix info [{}] ...", refresh);
Datum::refresh_with(&mut self.nix_info, async {
NixInfo::from_nix(&nix_rs::command::NixCmd::default())
Expand Down

0 comments on commit 4334f2c

Please sign in to comment.