Skip to content

refactor(game-client): remove dead code and redundant assignments#706

Open
kamilwronka wants to merge 1 commit intodevelopfrom
claude/zealous-gould
Open

refactor(game-client): remove dead code and redundant assignments#706
kamilwronka wants to merge 1 commit intodevelopfrom
claude/zealous-gould

Conversation

@kamilwronka
Copy link
Copy Markdown
Contributor

@kamilwronka kamilwronka commented Apr 8, 2026

Summary

  • Delete unused use-create-battle.tsx — this file has zero imports across the codebase; battle creation uses createBattle from api.service.ts instead
  • Remove redundant property assignments in composeNpcFromGamenick, prof, wt, lvl, type were re-assigned from npc but already present via the ...npc spread
  • Remove commented-out party field in battlelog.mappers.ts — dead commented code

Safety rationale

  • use-create-battle.tsx: confirmed zero imports via grep; all battle creation flows use api.service.ts
  • composeNpcFromGame: the removed lines were no-ops (assigning npc.X over ...npc which already includes X)
  • Commented-out code removal: no behavior change

Test plan

  • All 224 game-client tests pass
  • Lint passes
  • Format check passes
  • Pre-commit hooks pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Internal restructuring of NPC-related logic
  • Chores
    • Removed unused code and cleaned up battle-related implementations

- Delete unused `use-create-battle.tsx` (no imports found; battle creation
  uses `createBattle` from `api.service.ts`)
- Remove redundant property re-assignments in `composeNpcFromGame` — the
  spread `...npc` already includes nick, prof, wt, lvl, type
- Remove commented-out `party` field in `battlelog.mappers.ts`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 936ac8bc-b9d4-4a5a-9fed-04cadb7fb87d

📥 Commits

Reviewing files that changed from the base of the PR and between f99033e and dfc7508.

📒 Files selected for processing (3)
  • apps/game-client/src/helpers/mappers/battlelog.mappers.ts
  • apps/game-client/src/hooks/api/use-create-battle.tsx
  • apps/game-client/src/hooks/game-events/helpers/npc.helpers.ts
💤 Files with no reviewable changes (3)
  • apps/game-client/src/helpers/mappers/battlelog.mappers.ts
  • apps/game-client/src/hooks/game-events/helpers/npc.helpers.ts
  • apps/game-client/src/hooks/api/use-create-battle.tsx

📝 Walkthrough

Walkthrough

The PR removes an unused React hook for creating battles, deletes a commented field from battle event mappers, and simplifies NPC composition by eliminating field assignments from one mapping function.

Changes

Cohort / File(s) Summary
Battlelog Cleanup
apps/game-client/src/helpers/mappers/battlelog.mappers.ts
Removed commented-out party field assignment from mapBattleEventsToPayload return object.
API Hook Removal
apps/game-client/src/hooks/api/use-create-battle.tsx
Deleted entire module including useCreateBattle hook and associated types (BattleEventPayload, UseCreateBattleOptions, CreateBattleResponse). Hook previously handled battle creation mutations with success/error toast notifications.
NPC Composition Simplification
apps/game-client/src/hooks/game-events/helpers/npc.helpers.ts
Removed explicit field assignments (nick, prof, wt, lvl, type) from composeNpcFromGame function; composeNpcFromEvent remains unchanged with those fields still explicitly set.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • lootlog/monorepo#655: Related NPC mapping changes; removes mapNpcs and sortNpcsByWt utilities that previously derived prof, type, and field ordering in NPCs.

Poem

🐰 Hooks are shed and comments cleaned,
NPCs leaner, trim and lean,
Battle creation fades away,
Simpler code to save the day! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(game-client): remove dead code and redundant assignments' directly and accurately summarizes the main changes: removing unused code (use-create-battle hook) and redundant assignments in composeNpcFromGame, plus cleanup of commented code.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/zealous-gould

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.

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