admin: eager-load the relations Filament tables resolve per row
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 領域
- backend, performance
調査の方向性
Start with GroupResource.php:88, TermsDocumentVersionResource.php:72,82, and AuditLogResource.php:88 to trace the per-row relation reads and the table queries that load each record. Then inspect UserResource.php:162,165 and the two model methods it calls, since making those methods use loaded relations affects other callers. Add eager loading for the first three resources and settle on safe behavior for the user methods; done when rendering these tables avoids per-row relation queries and the affected behavior is covered.
索引モデルが issue の本文から書いたものです。
説明
Context
Several admin tables resolve a relation inside a per-row ->state() closure with no eager loading, so each rendered row issues its own query.
Found while fixing #190, where two relation managers had the same defect. Those two are fixed; this is the rest of the panel.
Affected
| File | Per-row relation |
|---|---|
GroupResource.php:88 |
$record->createdByUser?->fullName() — no getEloquentQuery or modifyQueryUsing at all |
TermsDocumentVersionResource.php:72,82 |
$record->document?->name and createdByUser, likewise nothing |
AuditLogResource.php:88 |
$presenter->actorName($record) |
UserResource.php:162,165 |
hasAcceptedCurrentTerms() and latestAcceptedTermsVersion() |
The first three are one with([...]) each.
UserResource is not. latestAcceptedTermsVersion() runs termsAcceptances()->with('acceptedVersion')->latest()->first(), so it is two queries per row — and the inner ->with() makes it look eager-loaded at the call site while the outer query is per-row. Fixing it means making those model methods read a loaded relation instead of querying, which changes behaviour for every other caller. That deserves a decision, not a one-liner.
Why one ticket rather than fixing them as they turn up
The finding that produced this was itself "fixed two, left the third". Handling them one relation manager at a time is how it got to four.
Note
Relations expressed as dotted column names (compartment.lockerBank.name) are visible; the same hop inside a ->state() closure is not. That is why these survived — worth knowing when adding a column.
- 主要言語
- PHP
- スター
- 26
- フォーク
- 2
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 14
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Open-Locker/Open-Locker のほかの issue
-
docs
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Open-Locker/Open-Locker#287 ·
メンテナーはふだん 1 日以内に返信
-
Research and adopt accessibility standards for Open-Locker対応中かも @issdn が今日担当しました。 オープンbackend docs mobile-app question
Open-Locker/Open-Locker#357 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Let the store app use live updates with a self-hosted backend対応中かも @issdn が今日担当しました。 オープンbackend enhancement mobile-app
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
Open-Locker/Open-Locker#353 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
enhancement mobile-app
難易度 4/5 1週間以上 初心者へのやさしさ 15/100
Open-Locker/Open-Locker#351 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
backend bug iot client
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
Open-Locker/Open-Locker#350 ·
メンテナーはふだん 1 日以内に返信
Open-Locker/Open-Locker の issue をすべて見る
似ている issue
-
bug ui
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
hashtopolis/server#2614 ·
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Перевод устарел
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
-
bug-report bug-report-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
Codeinwp/wp-maintenance-mode#596 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信