mirror of
https://github.com/penpot/penpot.git
synced 2026-08-08 13:58:35 +00:00
The dashboard's unread-comment-threads flow fired one get-profiles-for-file-comments RPC call per file-id, producing 20+ concurrent HTTP requests and 20+ SQL queries for users with unread threads across multiple files. Widen the existing get-profiles-for-file-comments RPC to accept a set of file ids (max 100) instead of a single id. The SQL uses ANY(?::uuid[]) so a 1-element set has the same query plan as the previous file_id = ?. Update the frontend unread-threads flow to send a single batch request, and the workspace fetch-profiles event to wrap the current file id in a 1-element set. The 100 cap is enforced in both the frontend (with a log/warn on overflow) and the schema (:max 100). Fixes #10587 AI-assisted-by: opencode-go/minimax-m3