Skip to content

Conversation

@thefatcode
Copy link

Summary

Fixes #656 - Maps -> Add New hardcrashes and requires Reload

Problem

The 'Add New' button on the EditConfigGrid page (used for Maps and other configuration types) was crashing because the PersistenceContext parameter was not being passed to the ModalCreateNew component. This caused a null reference exception when the CreationAutoFields component tried to use it for lookups.

Solution

Pass the creationContext as the PersistenceContext parameter when showing the ModalCreateNew modal dialog, consistent with how other parts of the codebase use this component (e.g., ItemTable.razor.cs).

Changes

  • src/Web/AdminPanel/Pages/EditConfigGrid.razor.cs: Added missing PersistenceContext parameter to modal parameters

@gemini-code-assist
Copy link

Summary of Changes

Hello @thefatcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily addresses and resolves a critical bug in the admin panel's configuration editing interface, specifically preventing a hard crash when users attempt to add new items like maps. The fix ensures that the necessary context parameter is correctly passed to the modal dialog, eliminating a null reference exception. Additionally, a minor but important game logic adjustment has been introduced, requiring players to equip a weapon before using certain movement-based skills.

Highlights

  • Critical Crash Fix: Resolved a hard crash that occurred when clicking the 'Add New' button on configuration grids (e.g., Maps) within the admin panel, which previously required a page reload.
  • Missing Parameter Resolution: The crash was caused by the ModalCreateNew component not receiving the PersistenceContext parameter, leading to a null reference exception when CreationAutoFields attempted to use it.
  • Consistent Parameter Passing: The fix involves correctly passing the creationContext as the PersistenceContext parameter to the ModalCreateNew modal dialog, aligning its usage with existing patterns in the codebase.
  • Skill Weapon Requirement: Implemented a new game logic rule: skills that move the attacker to the target (such as 'Twisting Slash' or 'Death Stab') now require the player to have a weapon equipped in their right-hand slot.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request primarily fixes a crash on the 'Add New' button in configuration grids by correctly passing the PersistenceContext to the modal dialog. This change is correct and directly addresses the issue described.

However, the pull request also includes an unrelated change in AreaSkillAttackAction.cs. This change adds a check for an equipped weapon for certain skills. While the intention is good, the implementation only checks the right-hand weapon slot, which could lead to incorrect behavior for characters using weapons in their left hand. I've added a specific comment with a suggestion for a more robust implementation. For better maintainability and clearer git history, it's recommended to keep unrelated changes in separate pull requests.

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.

Maps -> Add New hardcrashes and requires Reload

1 participant