Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist Signal state to disk (recently visited flakes now persist) #98

Merged
merged 21 commits into from
Nov 1, 2023
Merged

Conversation

srid
Copy link
Member

@srid srid commented Oct 31, 2023

For #96 by leveraging DioxusLabs/sdk#17

  • "Recent flakes" should work
  • Add a default list of flakes (if recent flakes is empty)

@srid srid changed the title Db Use sqlite db Oct 31, 2023
@srid srid changed the title Use sqlite db Persist Signal state to disk Nov 1, 2023
@srid srid mentioned this pull request Nov 1, 2023
3 tasks
@srid srid changed the title Persist Signal state to disk Persist Signal state to disk (recently visited flakes now persist) Nov 1, 2023
@srid srid marked this pull request as ready for review November 1, 2023 21:24
Comment on lines +75 to +83
fn new(cx: Scope) -> Self {
tracing::debug!("🔨 Creating AppState default value");
let recent_flakes =
storage::<LocalStorage, _>(cx, "recent_flakes".to_string(), FlakeUrl::suggestions);
AppState {
recent_flakes,
..AppState::default()
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (storage::<LocalStorage, _>) is how we create a dioxus Signal that is backed by a persistent storage behind the scenes, thus making the signal itself persistent across app restarts!

@srid srid merged commit bd48220 into main Nov 1, 2023
22 checks passed
@srid srid deleted the db branch November 1, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant