mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-11 02:44:15 +00:00
draft records cleanup on window remove
This commit is contained in:
parent
f70d159ca7
commit
bdd1292039
15
src/app.rs
15
src/app.rs
@ -104,7 +104,7 @@ impl App {
|
|||||||
let browser = browser.clone();
|
let browser = browser.clone();
|
||||||
let database = database.clone();
|
let database = database.clone();
|
||||||
move |this| {
|
move |this| {
|
||||||
// @TODO restore previous session from DB
|
// Restore previous session from DB
|
||||||
match database.records() {
|
match database.records() {
|
||||||
Ok(records) => {
|
Ok(records) => {
|
||||||
for record in records {
|
for record in records {
|
||||||
@ -127,14 +127,21 @@ impl App {
|
|||||||
|
|
||||||
// Save current session to DB
|
// Save current session to DB
|
||||||
app.connect_window_removed({
|
app.connect_window_removed({
|
||||||
|
// let browser = browser.clone();
|
||||||
let database = database.clone();
|
let database = database.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
// Cleanup previous record
|
|
||||||
match database.records() {
|
match database.records() {
|
||||||
Ok(records) => {
|
Ok(records) => {
|
||||||
|
// Cleanup previous records
|
||||||
|
for record in records {
|
||||||
|
match database.delete(record.id) {
|
||||||
|
Ok(_) => {
|
||||||
// Delegate clean action to children components
|
// Delegate clean action to children components
|
||||||
// self.browser.clean(app_id) @TODO
|
// browser.clean(app_id); @TODO
|
||||||
// ..
|
}
|
||||||
|
Err(error) => panic!("{error}"), // @TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create new record
|
// Create new record
|
||||||
match database.add() {
|
match database.add() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user