Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested lens usage refactor (part 1) #2268

Merged
merged 10 commits into from
Jan 6, 2025
Merged

Conversation

kostmo
Copy link
Member

@kostmo kostmo commented Jan 5, 2025

Towards #2265.

This will be a multi-part refactoring, since uiGamestate is accessed in hundreds of places. The more repetition that can be eliminated, the easier it will be to eventually modify the type of the record fields.

In this PR, a few no-op refactorings:

  • use a narrower type in many places (e.g. pass UIGameplay rather than AppState as function parameter
  • define local aliases for long lens chains
  • Use zoom for blocks of operations on deeply nested state

@kostmo kostmo changed the title refactor UIState refactor (part 1) Jan 5, 2025
@kostmo kostmo force-pushed the refactor/ui-gameplay-optional-part1 branch from 4d1781d to d4f4676 Compare January 6, 2025 01:05
@kostmo kostmo added the Z-Refactoring This issue is about restructuring the code without changing the behaviour to improve code quality. label Jan 6, 2025
@kostmo kostmo changed the title UIState refactor (part 1) nested lens usage refactor (part 1) Jan 6, 2025
@kostmo kostmo requested a review from byorgey January 6, 2025 01:33
@kostmo kostmo marked this pull request as ready for review January 6, 2025 01:33
@kostmo kostmo added the merge me Trigger the merge process of the Pull request. label Jan 6, 2025
@mergify mergify bot merged commit 2193e84 into main Jan 6, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request. Z-Refactoring This issue is about restructuring the code without changing the behaviour to improve code quality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants