Skip to content

[Bug]: Real-time socket events do not fire for PATCH and PUT record updates #1737

Description

@Twix1288

What's the bug?

When a database record is modified via the PostgREST proxy endpoint (backend/src/api/routes/database/records.routes.ts), the backend is supposed to broadcast a DATA_UPDATE socket event so the dashboard data grid can instantly refresh.

However, the socket broadcast logic explicitly ignores PATCH and PUT requests

Because PATCH and PUT are omitted, any updates made to existing rows do not trigger a real-time UI refresh for other connected admins. The data grid becomes stale and requires a manual page reload to see the changes.

(Note: The bespoke admin.routes.ts endpoint does correctly broadcast this event for router.patch, confirming this is an unintended omission in records.routes.ts.)

// backend/src/api/routes/database/records.routes.ts
// Broadcast socket events for mutations
if (['POST', 'DELETE'].includes(method)) {
  const socket = SocketManager.getInstance();
  // ... socket.broadcastToRoom('role:project_admin', ServerEvents.DATA_UPDATE, ...)
}

### How to reproduce

### How to reproduce
```markdown
1. Open the InsForge dashboard and navigate to a database table's Data Grid view in two separate browser windows (simulating two active admins).
2. In Window A, edit a field on an existing record and save it (this fires a `PATCH` request).
3. Observe Window B. The data grid will not update automatically to reflect the edit.
4. Manually refresh Window B to finally see the updated data.

### Environment (optional)

- **OS:** All
- **Browser:** All
- **Version:** Latest `main`

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions