fix: three pre-emptive issues caught before push
- store: removeFolder now also resets exploreTagsFolderId so the Explore tag list is invalidated when a folder is removed, not just tagCloud - db: delete_folder moves vector::delete_embedding calls outside the transaction — sqlite-vec virtual-table DML is unreliable inside a transaction and caused remove_folder to fail for folders with embeddings - store: loadMoreImages now passes similarSourceFolderId as the fourth arg to loadSimilarImages; omitting it caused each paginated load to overwrite the state with similarFolderId, corrupting scope-switches that use similarSourceFolderId afterward
This commit is contained in:
+9
-4
@@ -2074,11 +2074,16 @@ pub fn delete_folder(conn: &Connection, folder_id: i64) -> Result<()> {
|
||||
rows
|
||||
};
|
||||
|
||||
let tx = conn.unchecked_transaction()?;
|
||||
for image_id in image_ids {
|
||||
vector::delete_embedding(&tx, image_id)?;
|
||||
vector::delete_caption_embedding(&tx, image_id)?;
|
||||
// Delete sqlite-vec rows outside any transaction — DML on virtual tables is
|
||||
// unreliable inside a transaction and will cause remove_folder to fail for
|
||||
// folders that have generated embeddings. The folder cascade (images rows)
|
||||
// is handled by the FK ON DELETE CASCADE when the folder row is deleted.
|
||||
for image_id in &image_ids {
|
||||
vector::delete_embedding(conn, *image_id)?;
|
||||
vector::delete_caption_embedding(conn, *image_id)?;
|
||||
}
|
||||
|
||||
let tx = conn.unchecked_transaction()?;
|
||||
tx.execute("DELETE FROM folders WHERE id = ?1", params![folder_id])?;
|
||||
tx.commit()?;
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user