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

fix: after deleting the form item, you will also get the form value #4481

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

anncwb
Copy link
Collaborator

@anncwb anncwb commented Sep 23, 2024

Description

fixed #4480

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • Run the tests with pnpm test.
  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features

    • Added "Star History" section to the README files, providing a visual representation of the repository's star count over time.
    • Introduced "更新日志" (Changelog) section in the Chinese README with a link to the changelog.
  • Bug Fixes

    • Enhanced error handling logic across various components to allow for more customized responses based on error details.
  • Chores

    • Updated various dependencies to their latest versions for improved stability and performance.

@anncwb anncwb added the bug Something isn't working label Sep 23, 2024
@anncwb anncwb requested review from vince292007 and a team as code owners September 23, 2024 14:37
Copy link

changeset-bot bot commented Sep 23, 2024

⚠️ No Changeset found

Latest commit: 9c5e4b4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Sep 23, 2024

Warning

Rate limit exceeded

@anncwb has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 11 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 75a113f and 9c5e4b4.

Walkthrough

The pull request introduces several changes across multiple files, focusing on the addition and reorganization of sections in various README files, specifically for Japanese, English, and Chinese versions. Modifications to error handling logic in request files enhance the flexibility of error responses. The FormApi class has been updated to improve state management, particularly in handling schema updates. Dependency versions in the pnpm-workspace.yaml file have also been updated to ensure compatibility with the latest releases.

Changes

File Change Summary
README.ja-JP.md, README.md, README.zh-CN.md Added or reorganized "Star History" and "Changelog" sections in respective README files.
apps/web-antd/src/api/request.ts, apps/web-ele/src/api/request.ts, apps/web-naive/src/api/request.ts, playground/src/api/request.ts Updated error handling logic in createRequestClient to include an additional parameter for customization.
packages/@core/ui-kit/form-ui/src/form-api.ts Modified FormApi class to change prevState visibility and improve schema update handling.
pnpm-workspace.yaml Updated dependency versions for various packages.

Assessment against linked issues

Objective Addressed Explanation
Ensure deleted fields do not appear on submission ( #4480 ) Changes to state management may address the issue, but it's unclear if the specific bug is fixed.

Suggested reviewers

  • vince292007

Poem

In the garden where changes bloom,
A rabbit hops, dispelling gloom.
With stars and logs, our docs align,
Error whispers, "All will be fine."
Forms now dance with schema grace,
In this code, we find our place! 🐇✨


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

@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: 5

Outside diff range and nitpick comments (4)
README.zh-CN.md (1)

127-129: LGTM: Addition of Star History section with a minor suggestion

The inclusion of the Star History chart is a nice touch that showcases the project's growth and popularity. It's well-placed at the end of the document.

Consider adding a brief description before the chart to provide context for new users. For example:

## Star History

下图展示了项目的 Star 增长历史:

[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date)
README.md (1)

127-129: Approved: Star History section adds value, but could be improved.

The addition of the Star History section is a great way to showcase the project's growing popularity. However, consider the following suggestions to enhance its effectiveness:

  1. Add a brief introductory text explaining what the chart represents.
  2. Ensure the chart renders correctly across different markdown viewers.

Consider adding a brief explanation before the chart, like this:

## Star History

This chart shows the growth in GitHub stars for the Vue Vben Admin project over time, reflecting its increasing popularity and adoption within the developer community.

[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date)
packages/@core/ui-kit/form-ui/src/form-api.ts (2)

92-92: Consider renaming updateState to reflect its specific purpose.

Renaming the method updateState to something more descriptive like handleDeletedSchemaFields can improve code readability by clearly indicating that it handles deletion of schema fields.


95-95: Translate the comment to English for consistency.

The inline comment // 进行了删除schema操作 should be translated to English to maintain consistency across the codebase.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1197efe and 73cd26b.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (9)
  • README.ja-JP.md (1 hunks)
  • README.md (1 hunks)
  • README.zh-CN.md (2 hunks)
  • apps/web-antd/src/api/request.ts (1 hunks)
  • apps/web-ele/src/api/request.ts (1 hunks)
  • apps/web-naive/src/api/request.ts (1 hunks)
  • packages/@core/ui-kit/form-ui/src/form-api.ts (3 hunks)
  • playground/src/api/request.ts (1 hunks)
  • pnpm-workspace.yaml (4 hunks)
Files skipped from review due to trivial changes (1)
  • README.ja-JP.md
Additional comments not posted (15)
apps/web-naive/src/api/request.ts (1)

Line range hint 1-98: Verify alignment with PR objectives

While the changes in this file enhance error handling capabilities, they don't appear to directly address the reported bug of form submissions including deleted field values.

To ensure we're not missing any relevant changes, let's search for form-related modifications:

If these searches don't yield relevant results, it might be worth clarifying with the PR author how the changes in this file relate to the reported bug, or if there are additional changes that should be included in this PR.

playground/src/api/request.ts (1)

97-100: Approved: Enhanced error handling capability, but clarification needed

The addition of the _error parameter and the explanatory comment improve the error handling infrastructure, allowing for more detailed error processing in the future. This is a positive change that doesn't introduce any breaking changes.

However, I have a few suggestions and questions:

  1. Consider adding a TODO comment to remind developers to implement custom error handling in the future. For example:

    // TODO: Implement custom error handling based on error codes
    message.error(msg);
  2. The current implementation doesn't utilize the new _error parameter. It might be beneficial to provide an example of how it could be used, even if it's just a console.log for debugging purposes.

  3. Could you clarify how this change relates to the PR objective of fixing the bug where deleted form items are still submitted? The connection isn't immediately clear from this code change.

pnpm-workspace.yaml (8)

24-24: LGTM: Minor version update for @iconify/json

The update from ^2.2.251 to ^2.2.252 for @iconify/json is a minor version bump, which typically indicates backward-compatible changes or bug fixes. This update is in line with good practices for keeping dependencies current.


27-27: LGTM: Patch update for @intlify/core-base

The update from ^10.0.2 to ^10.0.3 for @intlify/core-base is a patch version bump, which typically indicates backward-compatible bug fixes. This update is appropriate and follows good practices for maintaining dependencies.


34-34: LGTM: Minor version update for @stylistic/stylelint-plugin

The update from ^3.0.1 to ^3.1.0 for @stylistic/stylelint-plugin is a minor version bump, which typically indicates backward-compatible new features or bug fixes. This update is in line with good practices for keeping dependencies current.


129-129: LGTM: Patch update for postcss-preset-env

The update from ^10.0.3 to ^10.0.5 for postcss-preset-env is a patch version bump, which typically indicates backward-compatible bug fixes. This update is appropriate and follows good practices for maintaining dependencies.


172-172: LGTM: Patch update for vue-i18n

The update from ^10.0.2 to ^10.0.3 for vue-i18n is a patch version bump, which typically indicates backward-compatible bug fixes. This update is appropriate and follows good practices for maintaining dependencies.

Given that vue-i18n is crucial for the project's internationalization features, this update may include important bug fixes or improvements relevant to the application's localization capabilities.


89-89: LGTM: Minor version update for eslint-plugin-import-x

The update from ^4.2.1 to ^4.3.0 for eslint-plugin-import-x is a minor version bump, which typically indicates backward-compatible new features or bug fixes. This update is appropriate for keeping the dependency current.

As this is an ESLint plugin, it's worth checking if there are any new or modified linting rules that might affect the project. You can use the following command to check the recent changes:

#!/bin/bash
# Fetch the changelog or release notes for eslint-plugin-import-x
gh repo view un-es/eslint-plugin-import-x --json url --jq .url | xargs -I {} gh api "{}releases" --jq '.[0] | {tag_name, body}'

Line range hint 24-172: Overall assessment of dependency updates

The changes in this file consist of minor and patch version updates to various dependencies. While these updates are good practice for maintaining the project's dependencies, they don't appear to directly address the form submission bug mentioned in the PR objectives (fixing the issue where deleted form fields are still submitted).

To ensure these updates don't introduce any unexpected changes or conflicts with the bug fix:

  1. Run the project's test suite:

  2. Manually test the form submission functionality described in the bug report:

If all tests pass and the manual verification confirms the bug fix, these dependency updates can be considered incidental to the main objective of the PR and do not pose any apparent issues.


28-28: LGTM: Minor version update for @intlify/unplugin-vue-i18n

The update from ^5.0.0 to ^5.2.0 for @intlify/unplugin-vue-i18n is a minor version bump, which typically indicates backward-compatible new features or bug fixes. This update is appropriate for keeping the dependency current.

As this update spans two minor versions (5.1.0 and 5.2.0), it would be prudent to review the changelog for any significant changes or new features that might affect the project. You can use the following command to check the recent changes:

README.zh-CN.md (3)

80-82: LGTM: Addition of Changelog section

The inclusion of a changelog section with a link to the GitHub releases page is a valuable addition. It provides users with easy access to the project's update history, which aligns well with the project's documentation and transparency.


80-82: Overall feedback on README changes

The additions to the README.zh-CN.md file (Changelog and Star History sections) are positive improvements that enhance the project's documentation and visibility. However, please consider the following points:

  1. Ensure that these changes don't overshadow the main purpose of the PR, which is to fix a bug related to form submission after deleting a form item.
  2. Verify that any removed content (as mentioned in the AI summary) was intentional and doesn't result in loss of important information.
  3. If applicable, consider adding a brief note about the bug fix in the Changelog section or elsewhere in the documentation to keep users informed about this improvement.

These README changes are approved, but please address the above points to ensure comprehensive documentation updates that align with the PR's primary objective.

Also applies to: 127-129


80-82: Verify alignment with PR objectives and previous content removal

While the additions to the README are valuable, they don't seem to directly address the bug fix mentioned in the PR objectives (form submission after deleting a form item). Consider the following points:

  1. Ensure that the necessary documentation updates related to the bug fix are included, if applicable.
  2. The AI summary mentioned that previous occurrences of the Changelog and Star History sections were removed. Please verify that these removals were intentional and that no important information was lost in the process.

To check for any unintended removals, you can run the following command:

This will help ensure that the changes are comprehensive and don't inadvertently remove important information.

Also applies to: 127-129

packages/@core/ui-kit/form-ui/src/form-api.ts (2)

69-71: Confirm the order of state updates in the onUpdate callback.

Updating prevState before assigning the new state ensures the previous state is accurately captured. This sequence appears correct.


105-105: Verify that setting field values to undefined prevents them from being submitted.

Setting the field value to undefined may not remove it from the form's submission data. Ensure that this approach effectively excludes the deleted fields from the submitted values. If necessary, consider using a method to remove the field entirely from the form's values.

apps/web-ele/src/api/request.ts Outdated Show resolved Hide resolved
apps/web-naive/src/api/request.ts Show resolved Hide resolved
apps/web-antd/src/api/request.ts Show resolved Hide resolved
packages/@core/ui-kit/form-ui/src/form-api.ts Outdated Show resolved Hide resolved
packages/@core/ui-kit/form-ui/src/form-api.ts Outdated Show resolved Hide resolved
@anncwb anncwb merged commit f815dcf into main Sep 23, 2024
13 checks passed
@anncwb anncwb deleted the bugfix/4480 branch September 23, 2024 15:00
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: from删除字段后提交依然存在
2 participants