Skip to content

Commit 30de04d

Browse files
committed
Preload user attachments before creating avatar_url list.
To avoid n+1 attachment queries. Problem exists on `documents/new` and `documents/:id/edit` when document category is Experimental and BlockNoteJS editor is enabled.
1 parent 6e74bde commit 30de04d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/primer/open_project/forms/block_note_editor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def initialize(input:, value:, document_id:)
5151
super()
5252
@input = input
5353
@value = value
54-
@users = User.active.map do |user|
54+
@users = User.active.preload(:attachments).map do |user|
5555
{
5656
id: user.id,
5757
username: user.name,

0 commit comments

Comments
 (0)