fix: browser testing issues and missing UI tools
- Fix WebSocket URL to use ws:// for http development environments - Make createLayer idempotent to prevent race-condition 500 under React StrictMode - Add URL-based routing for /register so register page actually shows register form - Add missing tool buttons to LeftSidebar: polygon, chair, extend, fillet - Add Playwright browser test suite for exhaustive UI testing - Update .gitignore for Playwright artifacts Unit tests: backend 254/254, frontend 380/380
This commit is contained in:
@@ -207,6 +207,10 @@ export class SqliteAdapter implements DatabaseInterface {
|
||||
|
||||
createLayer(data: Partial<DBLayer>): DBLayer {
|
||||
const id = data.id ?? `layer-${Date.now()}`;
|
||||
// Idempotent: if a layer with the same id already exists, return it.
|
||||
// This prevents race conditions under React StrictMode double-render.
|
||||
const existing = this.db.prepare('SELECT * FROM layers WHERE id = ?').get(id) as DBLayer | undefined;
|
||||
if (existing) return existing;
|
||||
this.db.prepare(
|
||||
'INSERT INTO layers (id, drawing_id, name, visible, locked, color, line_type, transparency, sort_order, parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
||||
).run(id, data.drawing_id!, data.name ?? 'Layer', data.visible !== undefined ? (data.visible ? 1 : 0) : 1, data.locked !== undefined ? (data.locked ? 1 : 0) : 0,
|
||||
|
||||
Reference in New Issue
Block a user