Skip to content

Comments

Small refactor: unnecessary Array.from#3279

Merged
FloPinguin merged 1 commit intomainfrom
unneeded-arrayfrom
Feb 23, 2026
Merged

Small refactor: unnecessary Array.from#3279
FloPinguin merged 1 commit intomainfrom
unneeded-arrayfrom

Conversation

@VariableVince
Copy link
Contributor

Description:

Array.from was performed on this.player.alliances(), which already returns an array. Also it was saved in a const which isn't strictly necessary, same goes for the array in the loop below it.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

tryout33

… array. Also saving in const isn't really necessary, same for the array in the loop below
@VariableVince VariableVince self-assigned this Feb 22, 2026
@VariableVince VariableVince requested a review from a team as a code owner February 22, 2026 21:47
@VariableVince VariableVince added Performance Performance optimization Refactor Code cleanup, technical debt, refactoring, and architecture improvements. labels Feb 22, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

This pull request simplifies iteration patterns in PlayerExecution.ts by removing unnecessary intermediate variables and array conversions. Methods are called directly within loops instead of storing results first, reducing object allocations without changing behavior.

Changes

Cohort / File(s) Summary
Direct iteration optimization
src/core/execution/PlayerExecution.ts
Removed intermediate variables for alliances and embargoes, iterating directly over method results instead of storing in temporary containers.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A tidy refactor, clean and lean,
No middlemen in the iteration scene,
Direct flows now, no array delays,
Simpler loops brighten coding days. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Small refactor: unnecessary Array.from' directly describes the main change—removing unnecessary Array.from calls and intermediate array declarations from PlayerExecution.ts.
Description check ✅ Passed The description explains that Array.from was unnecessary because this.player.alliances() already returns an array, and similar unnecessary const declarations were removed—clearly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Collaborator

@evanpelle evanpelle left a comment

Choose a reason for hiding this comment

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

thanks!

@github-project-automation github-project-automation bot moved this from Triage to Final Review in OpenFront Release Management Feb 23, 2026
@VariableVince
Copy link
Contributor Author

thanks!

The merge didn't trigger it seems

(probably because of the unrelated Build error 6 hours ago. Reran that job and it's green now. But the merge needs a nudge)

@FloPinguin FloPinguin added this to the v30 milestone Feb 23, 2026
@FloPinguin FloPinguin added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit 4788316 Feb 23, 2026
16 of 18 checks passed
@FloPinguin FloPinguin deleted the unneeded-arrayfrom branch February 23, 2026 09:20
@github-project-automation github-project-automation bot moved this from Final Review to Complete in OpenFront Release Management Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Performance Performance optimization Refactor Code cleanup, technical debt, refactoring, and architecture improvements.

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants