Skip to content

fix(NativeTreeStore): Don't drop statements when a batch fails - #2385

Closed
kenrestivo wants to merge 1 commit into
floccusaddon:developfrom
kenrestivo:fix/native-tree-store-dropped-writes
Closed

kenrestivo wants to merge 1 commit into
floccusaddon:developfrom
kenrestivo:fix/native-tree-store-dropped-writes

Conversation

@kenrestivo

Copy link
Copy Markdown

On Android, since late September's release, using WebDAV, Floccus only showed "there are no bookmarks here" when there were hundreds.

flushNow emptied the queue before NativeDatabase.batch ran, so a failed transaction lost its rows for good while the in-memory tree kept the items. The native UI reads only the rows, so folders showed up empty, and the next load hydrated the tree from the incomplete rows.

Put the statements back in front of the queue on failure, chain each batch to the previous one so the retry keeps its order, and let flush() write whatever a failed batch left queued. Same fix as ffbf7f9 for NativeCacheStore.

Assisted-by: ClaudeCode:claude-opus-5.5

flushNow emptied the queue before NativeDatabase.batch ran, so a failed
transaction lost its rows for good while the in-memory tree kept the items.
The native UI reads only the rows, so folders showed up empty, and the next
load hydrated the tree from the incomplete rows.

Put the statements back in front of the queue on failure, chain each batch
to the previous one so the retry keeps its order, and let flush() write
whatever a failed batch left queued. Same fix as ffbf7f9 for NativeCacheStore.

Assisted-by: ClaudeCode:claude-opus-5.5
@marcelklehr

Copy link
Copy Markdown
Member

Ah, damn. Thank you for taking the time to implement this fix!

@marcelklehr

Copy link
Copy Markdown
Member

I think we need flush() to pass the error on, and load() shouldn't really rebuild the tree over statements that are still queued. The cache store already handles both of these.

@marcelklehr

Copy link
Copy Markdown
Member

I hope you don't mind, I've committed this myself and added a test :) Thank you still for raising this, I forgot to make this change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants