fix(TeamParticipants): isolate missing team template errors per participant#7534
fix(TeamParticipants): isolate missing team template errors per participant#7534Eetwalt wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Module:TeamCard/Legacy to prevent a single missing team template from breaking an entire legacy TeamCard block by filtering out “broken” cards, rendering per-card error boxes, and adding a tracking category for discoverability.
Changes:
- Added per-card team template existence checks and partitioned cards into “valid” vs “broken”, rendering broken ones as
ambox-rederror boxes and tracking them via a new category. - Adjusted rendering behavior so
externalControlsRenderedis only set (and TeamParticipants rendering only invoked) when at least one valid card exists. - Added/updated Lua spec coverage for missing-template partitioning behavior and stubbing
TeamTemplate.exists.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lua/wikis/commons/TeamCard/Legacy.lua | Adds per-card template validation, error widget rendering, tracking category, and conditional TP rendering. |
| lua/spec/teamcard_legacy_spec.lua | Adds specs for missing-template handling and stubs TeamTemplate.exists where needed. |
Comments suppressed due to low confidence (1)
lua/wikis/commons/TeamCard/Legacy.lua:132
minimumplayersis computed fromdefaultRowNumber/extraRowsbeforepreprocessCardis applied. This breaks existing custom wrappers that set these fields inpreprocessCard(e.g.lua/wikis/arenafps/TeamCard/Legacy/Custom.luasetsdefaultRowNumberbased on a variable), and can change roster filling. Consider preprocessing cards first (or recomputing rows after preprocessing) sominimumplayersreflects the final card args.
defaultRows = tonumber(card.defaultRowNumber) or defaultRows
extraRows = tonumber(card.extraRows) or extraRows
end)
local tpArgs = {
minimumplayers = defaultRows + extraRows + toggleFolded.extraPlayers,
showplayerinfo = toggleFolded.showPlayerInfo and 'true' or nil,
}
Array.forEach(validCards, function(card)
if dependency.preprocessCard then
card = dependency.preprocessCard(card)
end
table.insert(tpArgs, LegacyTeamCard.mapCard(card))
end)
if not Namespace.isMain() then
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
If it's not harder, I would put it in the TP and not in TC legacy |
Yeah good call, modified the approach and tested |
| children = Div{ | ||
| classes = { 'team-participant__grid' }, | ||
| children = Array.map(participants, function(participant) | ||
| return ParticipantsTeamCard{ |
There was a problem hiding this comment.
We can't use the new ErrorBoundary here instead yet, right?
There was a problem hiding this comment.
Not instead afaik. Our throw is Opponent.toName inside parseParticipant, and Repository.save hits the same path. Both run before any widget is built, so ErrorBoundary in the view can't catch them. We need the parser-level flag to gate storage either way.
Wrapping each valid ParticipantsTeamCard in ErrorBoundary as per-card defense-in-depth (like Squad) would still be nice, but I'd say as a follow-up instead in this PR.
I might be wrong though, not 100% familiar with ErrorBoundary yet
Summary
TeamParticipants/Parse/Wiki.parseParticipantmarks a participant asbrokenwhen its team template doesn't resolve, instead of throwing inOpponent.toName/Opponent.resolveand taking down the whole renderPages with missing team templatestracking categoryWidget/Participants/Team/CardsGroupaccepts abrokenParticipantsprop and renders anErrorDisplay.Boxper entry above the gridHow did you test this change?
dev