From 3ba455b415903552223d672ccb594e9ea40ac532 Mon Sep 17 00:00:00 2001 From: Julian Date: Wed, 16 Oct 2024 09:46:52 -0500 Subject: [PATCH] missed rust client changes --- crates/rust-client/src/store/web_store/js/schema.js | 2 +- crates/rust-client/src/store/web_store/js/sync.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/rust-client/src/store/web_store/js/schema.js b/crates/rust-client/src/store/web_store/js/schema.js index 0c175e8af..6a53841cd 100644 --- a/crates/rust-client/src/store/web_store/js/schema.js +++ b/crates/rust-client/src/store/web_store/js/schema.js @@ -46,7 +46,7 @@ db.version(1).stores({ [Table.StateSync]: indexes('id'), [Table.BlockHeaders]: indexes('blockNum', 'hasClientNotes'), [Table.ChainMmrNodes]: indexes('id'), - [Table.Tags]: indexes('tag', 'source_note_id', 'source_account_id'), + [Table.Tags]: indexes('id++', 'tag', 'source_note_id', 'source_account_id'), }); function indexes(...items) { diff --git a/crates/rust-client/src/store/web_store/js/sync.js b/crates/rust-client/src/store/web_store/js/sync.js index daed221e3..7c007c873 100644 --- a/crates/rust-client/src/store/web_store/js/sync.js +++ b/crates/rust-client/src/store/web_store/js/sync.js @@ -56,7 +56,7 @@ export async function addNoteTag( source_note_id: source_note_id ? source_note_id : "", source_account_id: source_account_id ? source_account_id : "" }); - } catch { + } catch (err) { console.error("Failed to add note tag: ", err); throw err; } @@ -97,7 +97,7 @@ export async function applyStateSync( transactionIds, transactionBlockNums ) { - return db.transaction('rw', stateSync, inputNotes, outputNotes, transactions, blockHeaders, chainMmrNodes, async (tx) => { + return db.transaction('rw', stateSync, inputNotes, outputNotes, transactions, blockHeaders, chainMmrNodes, tags, async (tx) => { await updateSyncHeight(tx, blockNum); await updateSpentNotes(tx, nullifierBlockNums, nullifiers); await updateBlockHeader(tx, blockNum, blockHeader, chainMmrPeaks, hasClientNotes); @@ -253,7 +253,7 @@ async function updateCommittedNotes( }); // Remove note tags - await tags.delete({ source_note_id: noteId }); + await tx.tags.where('source_note_id').equals(noteId).delete(); } } catch (error) { console.error("Error updating committed notes:", error);