From 5a6de53559a74d5183dc705aad89f318f3378c6f Mon Sep 17 00:00:00 2001 From: Egutierrez Date: Fri, 1 May 2026 02:04:06 +0200 Subject: [PATCH] =?UTF-8?q?fix(views):=20WHERE=20expanded=20en=20sync=20?= =?UTF-8?q?=E2=80=94=20comparar=20INTEGER=201,=20no=20json('true')?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- views.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/views.cpp b/views.cpp index 48f50b2..265efb7 100644 --- a/views.cpp +++ b/views.cpp @@ -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);