Skip to content

fix(diagnostics): avoid duplicate child stat updates - #408

Open
Ninzinhu wants to merge 1 commit into
Mojang:mainfrom
Ninzinhu:codex/fix-duplicate-child-stat-updates
Open

Ninzinhu wants to merge 1 commit into
Mojang:mainfrom
Ninzinhu:codex/fix-duplicate-child-stat-updates

Conversation

@Ninzinhu

@Ninzinhu Ninzinhu commented Oct 8, 2026

Copy link
Copy Markdown

Summary\n\nFixes duplicate child statistic updates in StatsProvider when more than one stats listener is registered.\n\nChild-stat recursion previously ran inside the listener loop. With N registered listeners, each child was recursively processed N times and broadcast to all N listeners, producing N² child update events instead of N.\n\n## Changes\n\n- Move child-stat recursion outside the listener iteration.\n- Preserve parent and aggregate-stat notification behavior.\n- Add a regression test with two listeners and a nested child statistic.\n\n## Validation\n\n-

pm run check-types\n-
pm run lint (one pre-existing warning)\n-
pm run test -- --run (35 passed)\n-
pm run build:all\n\n## Before / after\n\nWith two listeners and one child statistic, the previous implementation delivered four child events. This change delivers two: one per listener.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant