Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/db/db-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ self.onmessage = async (event: MessageEvent) => {

const { statements } = payload as TransactionPayload;

// Clear any dangling transaction state from a prior exec() with
// RETURNING — SQLite WASM's oo1.DB.exec can leave autocommit off
// after INSERT…RETURNING with returnValue:'resultRows'.
try { db.exec('COMMIT;'); } catch (err) {
const msg = err instanceof Error ? err.message : String(err);
if (!msg.includes('no transaction is active')) {
throw err; // Unexpected error — rethrow
}
}

db.exec('BEGIN TRANSACTION;');
try {
const results = [];
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/features.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ test.describe('Entity Editor with Source URL', () => {
const sourceInput = page.locator('#entity-source-url');
await sourceInput.fill('https://example.com/persisted-article');

// Wait for tiptap editor to initialize before saving
// Wait for tiptap editor to fully initialize (useEditor hook returns non-null)
await expect(page.locator('.tiptap-content')).toBeVisible({ timeout: 5000 });
await expect(page.locator('.tiptap-content .ProseMirror[contenteditable="true"]')).toBeVisible({ timeout: 5000 });

// Save entity
const saveBtn = page.locator('button.primary', { hasText: 'Save to DB' });
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ test.describe('Library View', () => {

await page.fill('input[placeholder="Entity Name (e.g. TRIZ)"]', 'Library Test Entity');
await page.selectOption('select', 'concept');
// Wait for tiptap editor to initialize before saving
// Wait for tiptap editor to fully initialize (useEditor hook returns non-null)
await expect(page.locator('.tiptap-content')).toBeVisible({ timeout: 5000 });
await expect(page.locator('.tiptap-content .ProseMirror[contenteditable="true"]')).toBeVisible({ timeout: 5000 });
await page.click('button:has-text("Save to DB")');
await expect(page.locator('[role="alert"]')).toContainText('Saved successfully', { timeout: 10000 });
});
Expand Down
Loading