Skip to content

fix(TeamParticipants): isolate missing team template errors per participant#7534

Open
Eetwalt wants to merge 4 commits into
mainfrom
tc-lw-tterror
Open

fix(TeamParticipants): isolate missing team template errors per participant#7534
Eetwalt wants to merge 4 commits into
mainfrom
tc-lw-tterror

Conversation

@Eetwalt
Copy link
Copy Markdown
Collaborator

@Eetwalt Eetwalt commented May 20, 2026

Summary

  • TeamParticipants/Parse/Wiki.parseParticipant marks a participant as broken when its team template doesn't resolve, instead of throwing in Opponent.toName / Opponent.resolve and taking down the whole render
  • Controller skips broken participants from storage and page-var writes, and emits the existing Pages with missing team templates tracking category
  • Widget/Participants/Team/CardsGroup accepts a brokenParticipants prop and renders an ErrorDisplay.Box per entry above the grid

How did you test this change?

dev

image

@Eetwalt Eetwalt requested a review from a team as a code owner May 20, 2026 11:31
Copilot AI review requested due to automatic review settings May 20, 2026 11:31
@Eetwalt Eetwalt requested a review from a team as a code owner May 20, 2026 11:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-red error boxes and tracking them via a new category.
  • Adjusted rendering behavior so externalControlsRendered is 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

  • minimumplayers is computed from defaultRowNumber/extraRows before preprocessCard is applied. This breaks existing custom wrappers that set these fields in preprocessCard (e.g. lua/wikis/arenafps/TeamCard/Legacy/Custom.lua sets defaultRowNumber based on a variable), and can change roster filling. Consider preprocessing cards first (or recomputing rows after preprocessing) so minimumplayers reflects 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.

Comment thread lua/wikis/commons/TeamCard/Legacy.lua Outdated
@Rathoz
Copy link
Copy Markdown
Collaborator

Rathoz commented May 20, 2026

If it's not harder, I would put it in the TP and not in TC legacy

@Eetwalt Eetwalt changed the title fix(TeamCard/Legacy): isolate missing team template errors per card fix(TeamParticipants): isolate missing team template errors per participant May 20, 2026
@Eetwalt
Copy link
Copy Markdown
Collaborator Author

Eetwalt commented May 20, 2026

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

@Eetwalt Eetwalt requested a review from Rathoz May 20, 2026 12:50
children = Div{
classes = { 'team-participant__grid' },
children = Array.map(participants, function(participant)
return ParticipantsTeamCard{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use the new ErrorBoundary here instead yet, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants