Repository navigation
feat(panel-app): S8 — wiring do ReactionSummary no feed e no thread (… - #578
Open
BrunaDomingues wants to merge 1 commit into
Open
BrunaDomingues wants to merge 1 commit into
BrunaDomingues wants to merge 1 commit into
Conversation
…e4rt#547) Pré-resolve counts/mine sem N+1, aposenta withCount('reactions') na timeline e reage a timeline.reaction-updated.
hefeus
reviewed
Oct 7, 2026
|
|
||
| /** @var Collection<string, TimelineReactionSummary> $reactionSummaries */ | ||
| $reactionSummaries = resolve(ReactionSummary::class) | ||
| ->forTimelines($items->getCollection()->pluck('id'), auth()->id()); |
Contributor
There was a problem hiding this comment.
Troca isso por auth()->user()?->id vai resolver seu problema.
hefeus
reviewed
Oct 7, 2026
| /** @var Collection<string, TimelineReactionSummary> $reactionSummaries */ | ||
| $reactionSummaries = $idsToFetch === [] | ||
| ? Collection::make() | ||
| : resolve(ReactionSummary::class)->forTimelines($idsToFetch, auth()->id()); |
Contributor
There was a problem hiding this comment.
Troca isso por auth()->user()?->id vai resolver seu problema.
hefeus
reviewed
Oct 7, 2026
| $rootReactionMine = $this->reactionMine; | ||
| } else { | ||
| $rootSummary = $reactionSummaries->get($this->timelineId); | ||
| $rootReactionCounts = $rootSummary?->counts ?? []; |
Contributor
There was a problem hiding this comment.
usar o $rootReactionCounts = $rootSummary->counts, pois o phpstan apontou que não precisa dessa validacao a mais pois o get acima sempre encontra algo.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(panel-app): S8 — wiring do ReactionSummary no feed e no thread (#547)
Pré-resolve counts/mine sem N+1, aposenta withCount('reactions') na timeline e reage a timeline.reaction-updated.
Contexto
A timeline web já tinha o enum, a action
ReactWith, o query objectReactionSummarye o componente LivewireReactions, mas o feed/thread ainda usavam o contador legado (withCount('reactions')/reactions_count) e não alimentavam o picker com o breakdown real.Esta alteração pré-resolve
counts/mineviaReactionSummary::forTimelines()noFeed,PostShoweThreadReplies, passa o estado para<livewire:timeline-reactions>e escutatimeline.reaction-updatedpara re-render sem reload — sem N+1 e com custo constante de consultas de reação.Alterações
Feed.php+feed.blade.php— batch deReactionSummaryapós paginar; removewithCount('reactions'); passacounts/mineaoPostShow; escutatimeline.reaction-updated.PostShow.php+post-show.blade.php— consome props do feed (ou consulta sozinho no thread); remove eager load/withCountdereactions; reações nas replies inline; escutatimeline.reaction-updated.ThreadReplies.php+thread-replies.blade.php— batch de summaries por página de replies e picker em cada resposta; escutatimeline.reaction-updated.ReactionSummaryWiringTest.php— breakdown feed/thread, custo constante (5 vs 25), ausência do contador legado, refresh apóstimeline.reaction-updated, summaries nas replies.Plano de Testes
make checkmake testphp artisan test --compact app-modules/panel-app/tests/Feature/Timeline/ReactionSummaryWiringTest.phpactivity_user_reactionswithCount('reactions')/reactions_counttimeline.reaction-updated)Evidências
Sem impacto visual novo além do wiring: o seletor (S7) passa a receber estado real. Validação principal via testes Livewire (
ReactionSummaryWiringTest.php).Issues Relacionadas
Closes #547
Related to #539