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" #2629

Merged
merged 1 commit into from
Jan 26, 2025

Conversation

nguyentvan7
Copy link
Collaborator

@nguyentvan7 nguyentvan7 commented Jan 26, 2025

Reverts #2592

Summary by CodeRabbit

Release Notes

  • Refactor

    • Removed non-stacking buff handling across multiple components
    • Simplified type definitions and import statements
    • Removed strikethrough property from display components
  • Code Cleanup

    • Streamlined artifact set effect calculations
    • Reduced complexity in data processing functions
    • Eliminated unused type and constant definitions

These changes represent internal optimizations that do not directly impact end-user functionality.

This reverts commit dd6dac4.
Copy link
Contributor

coderabbitai bot commented Jan 26, 2025

Walkthrough

This pull request introduces significant changes to the handling of non-stacking buffs and artifact set effects across multiple libraries. The modifications primarily involve removing nonStacking related logic, simplifying type definitions, and adjusting how set bonuses and team buffs are calculated. The changes span several files in the Genshin Optimizer project, focusing on streamlining buff and artifact set effect implementations.

Changes

File Change Summary
libs/gi/sheets/src/Artifacts/NoblesseOblige/index.tsx Removed set4TallyWrite, simplified set effect calculation, removed nonStacking property
libs/gi/sheets/src/SheetUtil.tsx Removed nonStackBuff function and related imports
libs/gi/ui/src/components/FieldDisplay.tsx Removed strikethrough property from display logic
libs/gi/ui/src/util/getCalcDisplay.tsx Replaced Typography component with fragment
libs/gi/uidata/src/uiData.ts Removed nonStacking import and related logic
libs/gi/wr/src/api.ts Simplified data merging and error handling logic
libs/gi/wr/src/formula.ts Removed allNonstackBuffs, NonStackBuff type, and nonStacking constant
libs/gi/wr/src/type.d.ts Updated type definitions, removed strikethrough and nonStacking properties

Possibly related PRs

Suggested reviewers

  • frzyc

Poem

🐰 Buffs and artifacts, a dance so light,
Complexity stripped away, code shining bright
Non-stacking logic, now swept clean
Simplicity reigns in this coding scene
A rabbit's leap of optimization delight! 🌟

✨ 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.

Sorry, something went wrong.

Copy link
Contributor

github-actions bot commented Jan 26, 2025

[frontend] [Sun Jan 26 17:46:10 UTC 2025] - Deployed 447f85b to https://genshin-optimizer-prs.github.io/pr/2629/frontend (Takes 3-5 minutes after this completes to be available)

[Sun Jan 26 17:50:41 UTC 2025] - Deleted deployment

@nguyentvan7 nguyentvan7 merged commit e8a420a into master Jan 26, 2025
8 of 9 checks passed
@nguyentvan7 nguyentvan7 deleted the revert-2592-van/go/nonStack branch January 26, 2025 17:50
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: 1

🧹 Nitpick comments (2)
libs/gi/wr/src/api.ts (1)

249-249: Improve code readability by avoiding assignment in expression.

The current code uses assignment within an expression, which can be confusing. Consider restructuring for better readability:

-      const base = path[0] === 'tally' ? ((path = path.slice(1)), tally) : input
+      let base = input
+      if (path[0] === 'tally') {
+        path = path.slice(1)
+        base = tally
+      }
🧰 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)

libs/gi/ui/src/util/getCalcDisplay.tsx (1)

223-227: Remove unnecessary Fragment.

The Fragment wrapper is redundant as it only contains a single map operation.

-    <>
      {components.map((x, i) => (
        <span key={i}>{x}</span>
      ))}
-    </>
🧰 Tools
🪛 Biome (1.9.4)

[error] 223-227: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 72d89fb and d2e1fbd.

📒 Files selected for processing (8)
  • 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/ui/src/util/getCalcDisplay.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)

libs/gi/ui/src/util/getCalcDisplay.tsx

[error] 223-227: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint
🔇 Additional comments (8)
libs/gi/sheets/src/Artifacts/NoblesseOblige/index.tsx (2)

3-4: LGTM! Import changes improve type safety.

The switch to equal and greaterEq functions provides better type checking compared to string-based comparisons.


15-18: LGTM! Simplified set4 calculation.

The calculation has been simplified while maintaining the same functionality:

  • Checks if Noblesse Oblige pieces >= 4
  • Applies 20% ATK buff when condition is 'on'
libs/gi/sheets/src/SheetUtil.tsx (1)

8-12: LGTM! Clean import statements.

The removal of NonStackBuff type import aligns with the codebase-wide removal of non-stacking buff functionality.

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

24-24: LGTM! Simplified imports.

The removal of nonStacking import aligns with the codebase-wide removal of non-stacking buff functionality.


Line range hint 44-48: LGTM! Simplified error handling.

The error handling has been streamlined to only check for non-existent paths in non-tally cases.

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

132-132: LGTM!

The removal of the strikethrough property from the destructuring is consistent with the PR's objective of removing non-stacking buff functionality.

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

607-607: LGTM!

The removal of nonStacking from exports aligns with the PR's objective and doesn't impact other formula calculations.

libs/gi/ui/src/util/getCalcDisplay.tsx (1)

223-227: LGTM!

The replacement of Typography with Fragment aligns with the removal of strikethrough functionality.

🧰 Tools
🪛 Biome (1.9.4)

[error] 223-227: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

tally?: NodeData<NumNode>
nonStacking?: Record<NonStackBuff, StrNode>
}
teamBuff?: Input & { tally?: NodeData }
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Maintain the numeric type constraint for teamBuff.tally

The codebase consistently uses teamBuff.tally with numeric values (e.g., constant(1)). Removing the NumNode type parameter could allow non-numeric nodes, potentially causing runtime errors. The suggested type constraint should be kept:

teamBuff?: Input & { tally?: NodeData<NumNode> }
🔗 Analysis chain

Consider maintaining type safety for the tally property.

The tally property type has been changed from NodeData<NumNode> to just NodeData, which could potentially allow non-numeric nodes. Consider keeping the numeric type constraint:

-  teamBuff?: Input & { tally?: NodeData }
+  teamBuff?: Input & { tally?: NodeData<NumNode> }
🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Search for usages of teamBuff.tally
rg "teamBuff.*tally" -t typescript -t javascript

# Look for NodeData and NumNode type definitions
ast-grep --pattern 'type NodeData'
ast-grep --pattern 'type NumNode'
ast-grep --pattern 'interface NodeData'
ast-grep --pattern 'interface NumNode'

# Find files that might contain tests related to teamBuff
fd "test|spec" -e ts -e js | grep -i "team.*buff"

Length of output: 293


Script:

#!/bin/bash
# Search for usages of teamBuff.tally with file extensions
rg "teamBuff.*tally" --type-add 'ts:*.{ts,tsx}' --type-add 'js:*.{js,jsx}' -t ts -t js -A 2 -B 2

# Look for NodeData and NumNode definitions and imports
rg "(type|interface) (NodeData|NumNode)" --type-add 'ts:*.{ts,tsx}' -t ts -A 2 -B 2
rg "import.*NodeData.*from" --type-add 'ts:*.{ts,tsx}' -t ts
rg "import.*NumNode.*from" --type-add 'ts:*.{ts,tsx}' -t ts

# Find the specific file we're reviewing to see its imports
fd "type.d.ts" -p "libs/gi/wr/src"

Length of output: 6490

nguyentvan7 added a commit that referenced this pull request Jan 27, 2025
* Add nonstacking to all relevant buffs

* fix

* dumdum proof

* Reapply "Add non-stacking buff back to NO4 in a smarter way (#2592)" (#2629)

This reverts commit e8a420a.

* Reapply "Fix formula text being janky (#2618)" (#2627)

This reverts commit 72d89fb.

---------

Co-authored-by: lantua <[email protected]>
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.

None yet

2 participants