Fix back navigation after modal fullscreen, fix SQL operator precedence
Navigation:
- Stale {modal:true}/{chartFull:true} history entries after app restart
caused back gesture to do nothing (no screen to render, no modal open).
Now global popstate handler skips these stale entries with history.back().
Rust seed import:
- Fixed SQL operator precedence in nutrients_guessed UPDATE:
WHERE (guessed IS NULL OR guessed = 0) AND name_lower IN (...)
was previously parsed as: guessed IS NULL OR (guessed = 0 AND ...)
which matched ALL products with NULL guessed regardless of name.
This commit is contained in:
parent
18738dc0aa
commit
62cdd7740f
2 changed files with 7 additions and 2 deletions
|
|
@ -3008,9 +3008,14 @@ function esc(str) {
|
|||
window.addEventListener("popstate", (e) => {
|
||||
// If a modal is open, don't handle here (modal has its own handler)
|
||||
if (document.querySelector(".modal-overlay")) return;
|
||||
// Stale modal/chart entries left after app restart — skip them
|
||||
if (e.state && (e.state.modal || e.state.chartFull)) {
|
||||
history.back();
|
||||
return;
|
||||
}
|
||||
// Pop our nav stack and navigate to previous screen
|
||||
if (navStack.length > 1) {
|
||||
navStack.pop(); // remove current
|
||||
navStack.pop();
|
||||
const prev = navStack[navStack.length - 1];
|
||||
renderScreen(prev, true);
|
||||
} else if (e.state && e.state.screen) {
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ fn import_seed_products(app: tauri::AppHandle) -> Result<String, String> {
|
|||
// Sync nutrients_guessed flag
|
||||
let _ = main_db.execute_batch(
|
||||
"UPDATE main.products SET nutrients_guessed = 1
|
||||
WHERE nutrients_guessed IS NULL OR nutrients_guessed = 0
|
||||
WHERE (nutrients_guessed IS NULL OR nutrients_guessed = 0)
|
||||
AND name_lower IN (SELECT s.name_lower FROM seed.products s WHERE s.nutrients_guessed = 1)"
|
||||
);
|
||||
// Sync micronutrients for products that have them in seed but not in main
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue