SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Typescript SDK bug for tables without primary keys

Open aasoni opened this issue 1 month ago • 3 comments

There appears to be an issue in the typescript SDK specifically with tables that do not have a primary key.

Symptoms: When an entry in a table without a primary key is inserted or deleted the change may not be reflected in the client cache and onInsert events may not be fired. This isn't 100% consistent and I suspect it may be related to inserting and deleting rows within the same transaction.

aasoni avatar Nov 04 '25 20:11 aasoni

Are you deleting and re-inserting the same row within a single transaction? If so, it is intended behavior that SpacetimeDB treats these as no-ops and does not broadcast any event to clients.

gefjon avatar Nov 04 '25 20:11 gefjon

Are you deleting and re-inserting the same row within a single transaction? If so, it is intended behavior that SpacetimeDB treats these as no-ops and does not broadcast any event to clients.

No this is definitely distinct rows. There is also this warning that is being printed from the sdk which I think indicates that something wrong is going on: ⚠️ WARN Deleting a row that was not present in the cache

aasoni avatar Nov 04 '25 20:11 aasoni

Actually the warning printed above happens during a transaction that deletes a single row from a table. So there isn't even an insert/delete happening in the same transaction. This is just a single delete.

aasoni avatar Nov 04 '25 20:11 aasoni