Closed alexmojaki closed 1 year ago
At first glance, I'm suspicious of SQLiteDB.runEach
, it looks weird and complicated, and is used when deleting columns. Might have some bug when not running on node-sqlite3. Will look into it.
I found this lurking, a parameter nested in an array - node-sqlite3
is happy with this, but sql.js
is not:
@@ -1093,7 +1093,7 @@ export class DocStorage implements ISQLiteDB, OnDemandStorage {
public _process_RemoveRecord(tableId: string, rowId: string): Promise<RunResult> {
const sql = "DELETE FROM " + quoteIdent(tableId) + " WHERE id=?";
debuglog("RemoveRecord SQL: " + sql, [rowId]);
- return this.run(sql, [rowId]);
+ return this.run(sql, rowId);
}
So looks like record removal was not working, at the database level - could see how that would cause a lot of problems :). Making a PR to grist-core. In future, I bet we could run a batch of grist-core browser tests against grist-static with a bit of tweaking.
Thanks @paulfitz! This works now. Should I convert https://github.com/gristlabs/grist-core/pull/564 to a diff?
Uses https://github.com/gristlabs/grist-core/pull/564
Visit http://localhost:3030/page/index_initial_data.html to test.
This almost works, but as it applies the actions it runs into a version of https://github.com/gristlabs/grist-static/issues/5:
It seems that the
['RemoveRecord', '_grist_Tables', 2]
action to remove the temporaryGristHidden_import
table is not properly processed before['AddRecord', '_grist_Tables', 2, {tableId: 'StudentData', primaryViewId: 0}]
.I've poked around and not been able to understand what's going wrong. It smells like a race condition, maybe something about transactions. @paulfitz I need help with this.