-
Notifications
You must be signed in to change notification settings - Fork 521
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: handled form using useEffect hook #2325
fix: handled form using useEffect hook #2325
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThe changes in this pull request involve the addition of a Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
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 (
|
@ankurjaiswalofficial is attempting to deploy a commit to the Unkey Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for following the naming conventions for pull request titles! 🙏 |
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
🧹 Outside diff range and nitpick comments (1)
apps/dashboard/app/(app)/apis/[apiId]/settings/delete-api.tsx (1)
87-93
: LGTM: useEffect hook implemented correctly.The useEffect hook successfully addresses the PR objective of resetting input fields when the dialog is closed. The implementation is correct and comprehensive, resetting both form fields and clearing errors.
Consider rephrasing the comment for clarity:
- // whenever the form is opened the state changes and on unmounting the dialog the form will automatically reset + // Reset form fields and clear errors when the dialog is closedThis more directly describes the hook's purpose and aligns with the PR objectives.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- apps/dashboard/app/(app)/apis/[apiId]/settings/delete-api.tsx (2 hunks)
🧰 Additional context used
🔇 Additional comments (3)
apps/dashboard/app/(app)/apis/[apiId]/settings/delete-api.tsx (3)
4-4
: LGTM: Import statement updated correctly.The addition of
useEffect
to the import statement is consistent with the PR objectives and the subsequent code changes. The explicit import ofuseState
is also a good practice, as it was already being used in the component.
99-99
: Good catch: Typo in class name corrected.The typo in the CSS class name has been fixed from "borrder-opacity-50" to "border-opacity-50". This correction ensures that the intended styling is applied correctly.
Line range hint
1-193
: Overall assessment: Changes successfully address the PR objectives.The implemented changes effectively solve the issue of input fields not resetting in the API delete dialog. The useEffect hook ensures that the form is reset when the dialog is closed, aligning perfectly with the PR objectives. The code is clean, well-structured, and the minor typo fix contributes to improved code quality.
To ensure the changes work as intended, please verify the following:
- The dialog opens and closes correctly.
- Input fields are properly reset when the dialog is closed and reopened.
- No console errors are thrown during this process.
You can use the following script to search for any remaining instances of the typo:
This will help ensure that the typo has been completely eliminated from the codebase.
@ankurjaiswalofficial please sign the CLA |
I signed it now |
This PR is incorrectly referencing another PR, not an issue. |
What does this PR do?
Updated the delete-api file where i added the useEffect to handle mounting and unmounting of the delete api dialog .
Fixes #2316
Type of change
How should this be tested?
Navigate to Dashboard => API's workspace => Select an API => Go to API Settings => Click on Delete API.
Open the Delete API dialog, enter data in the input fields, close the dialog, and then reopen it.
Verify that the input fields are reset to their default (empty) state on reopening.
Checklist
Required
pnpm build
pnpm fmt
console.logs
git pull origin main
Appreciated
Summary by CodeRabbit
New Features
Bug Fixes