-
-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Description
Describe the bug
When using store.setCell() on an existing cell, the expected behaviour is that the cell will have its value changed and the rest of the row remains unchanged. However, when using a custom SQLite persister with orReplace=1 set, the generated SQL will look as such:
INSERT OR REPLACE "table_name" ("_id","col_to_change") VALUES (?,?);The issue with this SQL is that every other column in the updated row will be set to NULL, which is probably not expected or desired behaviour.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
- Create a tabular store with some data
- Create a SQLite persister that uses
orReplace=1(I used PowerSync) - Use
setCellto update a single cell in the store - Generated SQL will null out all fields except replaced field and PK
Expected behavior
The expected behaviour is that the cell that is changed will be updated and the remaining cells will not be set to null. The generated SQL could look something like this:
INSERT OR REPLACE "table_name" ("_id","col_to_change","other_col_1","other_col_2","...") VALUES (?,?,?,?,...);Screenshots or Videos
No response
Platform
- OS: macOS 14.5
- Browser: Chrome
- Version: Tinybase v5.3.1
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels