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

Revert "Add non-stacking buff back to NO4 in a smarter way" #2626

Closed
wants to merge 2 commits into from

Conversation

nguyentvan7
Copy link
Collaborator

@nguyentvan7 nguyentvan7 commented Jan 26, 2025

Reverts #2592

Summary by CodeRabbit

Release Notes

  • Refactor

    • Removed nonStacking functionality across multiple components
    • Simplified type definitions and data handling
    • Removed unused utility functions and imports
  • Bug Fixes

    • Updated artifact set effect calculations
    • Removed deprecated strikethrough property from field displays

The changes primarily focus on cleaning up and streamlining the codebase by removing non-essential functionality and simplifying type definitions.

Copy link
Contributor

coderabbitai bot commented Jan 26, 2025

Walkthrough

This pull request involves a comprehensive cleanup and simplification of non-stacking buff functionality across multiple files in the Genshin Optimizer project. The changes primarily focus on removing the nonStacking related code, simplifying type definitions, and updating artifact set logic, particularly for the NoblesseOblige set. The modifications span several libraries, including sheets, UI data, and working repository (wr) modules, indicating a systematic approach to removing a specific code pattern.

Changes

File Change Summary
libs/gi/sheets/src/Artifacts/NoblesseOblige/index.tsx Removed set4TallyWrite, simplified set4 calculation, eliminated nonStacking from teamBuff
libs/gi/sheets/src/SheetUtil.tsx Removed nonStackBuff function and NonStackBuff type
libs/gi/ui/src/components/FieldDisplay.tsx Removed strikethrough property extraction from calculation results
libs/gi/uidata/src/uiData.ts Removed nonStacking import and related logic
libs/gi/wr/src/api.ts Removed nonStacking import and simplified mergeData function
libs/gi/wr/src/formula.ts Removed allNonstackBuffs, NonStackBuff type, and nonStacking constant
libs/gi/wr/src/type.d.ts Removed NonStackBuff type, strikethrough property, and nonStacking from teamBuff

Possibly related PRs

Suggested Labels

SRO

Suggested Reviewers

  • frzyc

Poem

🐰 Farewell, non-stacking code so neat,
Buffs simplified, a cleaner feat!
Rabbit hops through lines of change,
Refactoring with a playful range 🧹
Optimization's gentle breeze 🍃

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

github-actions bot commented Jan 26, 2025

[frontend] [Sun Jan 26 14:54:09 UTC 2025] - Deployed f2a6017 to https://genshin-optimizer-prs.github.io/pr/2626/frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Sun Jan 26 17:39:11 UTC 2025] - Deployed 20a75b8 to https://genshin-optimizer-prs.github.io/pr/2626/frontend (Takes 3-5 minutes after this completes to be available)

[Sun Jan 26 17:42:12 UTC 2025] - Deleted deployment

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/gi/wr/src/type.d.ts (1)

182-182: Consider using a more explicit type definition.

The current type definition might be simplified further:

-  teamBuff?: Input & { tally?: NodeData }
+  teamBuff?: Input & { tally?: NodeData<T> }

This change would make the generic type parameter T consistent throughout the interface.

libs/gi/wr/src/api.ts (1)

249-249: Refactor assignment for better readability.

The current code combines assignment with expression evaluation, which could be confusing.

-      const base = path[0] === 'tally' ? ((path = path.slice(1)), tally) : input
+      let base = input
+      if (path[0] === 'tally') {
+        path = path.slice(1)
+        base = tally
+      }

This change:

  • Separates the assignment from the expression
  • Makes the code more readable
  • Addresses the static analysis warning
🧰 Tools
🪛 Biome (1.9.4)

[error] 249-249: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27a9181 and 919290e.

📒 Files selected for processing (7)
  • libs/gi/sheets/src/Artifacts/NoblesseOblige/index.tsx (2 hunks)
  • libs/gi/sheets/src/SheetUtil.tsx (1 hunks)
  • libs/gi/ui/src/components/FieldDisplay.tsx (1 hunks)
  • libs/gi/uidata/src/uiData.ts (0 hunks)
  • libs/gi/wr/src/api.ts (3 hunks)
  • libs/gi/wr/src/formula.ts (1 hunks)
  • libs/gi/wr/src/type.d.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • libs/gi/uidata/src/uiData.ts
🧰 Additional context used
🪛 Biome (1.9.4)
libs/gi/wr/src/api.ts

[error] 249-249: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

🔇 Additional comments (7)
libs/gi/sheets/src/Artifacts/NoblesseOblige/index.tsx (3)

3-4: LGTM! Code simplification improves readability.

The changes simplify the logic by using direct comparison functions and removing string-based comparisons, making the code more maintainable.

Also applies to: 15-19


Line range hint 21-29: LGTM! Simplified teamBuff structure.

The removal of non-stacking buff functionality from the teamBuff object aligns with the PR objectives.


Line range hint 31-55: LGTM! Sheet object structure maintained.

The sheet object structure remains clean and functionally equivalent after the changes.

libs/gi/sheets/src/SheetUtil.tsx (1)

8-13: LGTM! Clean removal of non-stacking functionality.

The removal of non-stacking buff related code simplifies the module while maintaining its core functionality.

libs/gi/wr/src/api.ts (1)

24-24: LGTM! Simplified imports and error handling.

The removal of non-stacking related code and the updated error message improve code clarity.

Also applies to: 44-47

libs/gi/ui/src/components/FieldDisplay.tsx (1)

132-132: Verify the UI feedback for buff stacking.

The removal of the strikethrough property changes how buff stacking is visually represented to users. Please ensure that users can still understand when buffs are not stacking through other visual cues or tooltips.

✅ Verification successful

Buff stacking visualization is well-implemented through alternative visual cues

The removal of the strikethrough property is adequately compensated by a comprehensive set of visual indicators:

  • Color-coded differences (green for positive, red for negative changes)
  • Explicit numerical comparisons with +/- signs
  • Tooltips showing detailed comparison values
  • Percentage differences for significant values
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining visual indicators or tooltips related to buff stacking

# Search for any remaining UI elements that might indicate buff stacking
rg -i "stack|buff" --type tsx --type ts

# Search for any tooltip text that might explain buff stacking
ast-grep --pattern 'title={$_}'

Length of output: 103


Script:

#!/bin/bash
# Search for buff/stack related code in TypeScript files
rg -i "stack|buff" --type ts --type typescript --type tsx

# Look for visual feedback mechanisms in FieldDisplay component
fd "FieldDisplay" --type f --exec cat {}

# Search for tooltip or visual indicator related code
rg -i "tooltip|title=|className|style" --type ts --type typescript --type tsx -g "FieldDisplay*"

Length of output: 16152

libs/gi/wr/src/formula.ts (1)

607-607: Verify buff calculations after removing non-stacking logic.

The removal of non-stacking buff functionality changes how buffs are calculated. Please ensure that:

  1. All buff calculations still work correctly without the non-stacking logic
  2. The game mechanics remain accurate
  3. There are no unintended buff stacking effects
✅ Verification successful

Buff calculations verified and working correctly after non-stacking removal

The current implementation maintains proper buff calculations through:

  • Clean additive accumulation of similar bonuses
  • Correct multiplicative interactions between different bonus types
  • Proper handling of base stats, modifiers, and total calculations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to non-stacking buffs and verify buff calculations

# Search for any remaining references to non-stacking buffs
rg -i "nonstack|no4" --type ts

# Check for buff-related calculations
ast-grep --pattern 'function $_(buff, $_) {
  $$$
}'

Length of output: 1449


Script:

#!/bin/bash
# Get the implementation of exported symbols and buff calculations
ast-grep --pattern 'function customBonus($$$) {
  $$$
}'

ast-grep --pattern 'const customBonus = $_'

# Check the complete file content to understand the context
cat libs/gi/wr/src/formula.ts

# Find usages of these exports
rg -l "import.*\{.*(customBonus|tally|target).*\} from.*formula" --type ts

Length of output: 21414

@nguyentvan7 nguyentvan7 deleted the revert-2592-van/go/nonStack branch January 26, 2025 17:42
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.

2 participants