fix(views): WHERE expanded en sync — comparar INTEGER 1, no json('true')

json_extract(metadata,'\$.expanded') devuelve INTEGER 1 cuando el valor JSON
es true; json('true') devuelve TEXT 'true', asi que la comparacion era
1 = 'true' = 0 (falso) y views_table_windows_sync nunca encontraba las
Tables expandidas.

El bug se manifestaba como context menu Expand table sin abrir la ventana,
aunque tableview_set_expanded persistia correctamente el flag en la BD.

Fix: comparar contra 1 directamente.
This commit is contained in:
2026-05-01 02:04:06 +02:00
parent ba0e038bc1
commit 5a6de53559
+3 -1
View File
@@ -1629,9 +1629,11 @@ void views_table_windows_sync(AppState& app, const char* ops_db) {
if (db) sqlite3_close(db);
return;
}
// json_extract devuelve INTEGER 1 para JSON true; comparamos contra 1
// (json('true') no es comparable directo — devuelve TEXT 'true').
const char* sql =
"SELECT id FROM entities "
"WHERE type_ref = 'Table' AND json_extract(metadata,'$.expanded') = json('true')";
"WHERE type_ref = 'Table' AND json_extract(metadata,'$.expanded') = 1";
sqlite3_stmt* st = nullptr;
if (sqlite3_prepare_v2(db, sql, -1, &st, nullptr) != SQLITE_OK) {
sqlite3_close(db);