-
Notifications
You must be signed in to change notification settings - Fork 238
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
ZO Add option to clear 4/2p set #2621
Conversation
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
/usr/local/bin/yarn: 3: dirname: not found Error: Cannot find module '/yarn.js' Node.js v22.9.0 WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
[zzz-frontend] [Sat Jan 25 20:34:30 UTC 2025] - Deployed 4082685 to https://genshin-optimizer-prs.github.io/pr/2621/zzz-frontend (Takes 3-5 minutes after this completes to be available) [zzz-frontend] [Sat Jan 25 20:46:17 UTC 2025] - Deployed 4082685 to https://genshin-optimizer-prs.github.io/pr/2621/zzz-frontend (Takes 3-5 minutes after this completes to be available) [Sat Jan 25 20:46:50 UTC 2025] - Deleted deployment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
libs/zzz/page-optimize/src/Optimize.tsx (2)
336-349
: Consider extracting duplicated filtering logic.The filtering logic for removing set constraints is duplicated across multiple places. Consider extracting it into a reusable function to improve maintainability.
+const removeSetConstraint = ( + constraints: Constraints, + setValue: number +) => Object.fromEntries( + Object.entries(constraints).filter( + ([k, { value }]) => !(allDiscSetKeys.includes(k as DiscSetKey) && value === setValue) + ) +) function Set4Selector({ constraints, setConstraints, }: { constraints: Constraints setConstraints: (c: Constraints) => void }) { // ... <MenuItem onClick={() => - setConstraints( - Object.fromEntries( - Object.entries(constraints).filter( - ([k, { value }]) => - !(allDiscSetKeys.includes(k as DiscSetKey) && value === 4) - ) - ) - ) + setConstraints(removeSetConstraint(constraints, 4)) } >
382-395
: Implementation looks good but could be simplified.The implementation correctly handles clearing the 2-set constraint. Apply the same refactoring suggestion as the 4-set clearing to maintain consistency and reduce code duplication.
<MenuItem onClick={() => - setConstraints( - Object.fromEntries( - Object.entries(constraints).filter( - ([k, { value }]) => - !(allDiscSetKeys.includes(k as DiscSetKey) && value === 2) - ) - ) - ) + setConstraints(removeSetConstraint(constraints, 2)) } >
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
libs/zzz/page-optimize/src/Optimize.tsx
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: lint
- GitHub Check: test
🔇 Additional comments (1)
libs/zzz/page-optimize/src/Optimize.tsx (1)
Line range hint
336-395
: Add test coverage for the new set clearing functionality.Please add unit tests to verify:
- Clearing 4-set constraints works correctly
- Clearing 2-set constraints works correctly
- Edge cases (e.g., clearing when no constraints exist)
- Integration with the optimization process
Would you like me to help generate the test cases?
Describe your changes
Add option to remove the forced 4/2 sets in optimize.
![image](https://private-user-images.githubusercontent.com/1754901/406686767-55fc5efd-1de3-48b5-915b-abd05e5c369c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMTM1ODMsIm5iZiI6MTczOTExMzI4MywicGF0aCI6Ii8xNzU0OTAxLzQwNjY4Njc2Ny01NWZjNWVmZC0xZGUzLTQ4YjUtOTE1Yi1hYmQwNWU1YzM2OWMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMTUwMTIzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmM5ZjRiNDgxYjk5MDQ5YjJhNWI4MjNhOGNmOGNkN2FkOWEwNmFjNTQ4MmM2MGFmZWU2NGZkMTA3ZTllNzc3YiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ouzzeOGCBu0Pd7Iu3_9GCXe9Y54iVqAahKc-YaKZImE)
Issue or discord link
Testing/validation
Checklist before requesting a review (leave this PR as draft if any part of this list is not done.)
yarn run mini-ci
locally to validate format and lint.Summary by CodeRabbit