-
Notifications
You must be signed in to change notification settings - Fork 544
fix: make contract and to addresses optional in webhook form #7294
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: make contract and to addresses optional in webhook form #7294
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
## Walkthrough
The changes update the webhook form UI by removing the required field asterisks from the "Contract Addresses" and "To Address" labels. The validation schema for the `addresses`, `fromAddresses`, and `toAddresses` fields was modified to make them optional and accept empty strings, validating only when non-empty input is provided. Additionally, the `addresses` argument passed to `useAbiMultiFetch` is now defaulted to an empty string if falsy.
## Changes
| File(s) | Change Summary |
|------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| .../webhooks/components/FilterDetailsStep.tsx | Removed required field asterisks from "Contract Addresses" and "To Address" labels in the form UI. |
| .../webhooks/utils/webhookTypes.ts | Made `addresses`, `fromAddresses`, and `toAddresses` optional and allowed empty strings; validation runs only on non-empty input. Updated error messages accordingly. |
| .../webhooks/components/CreateWebhookModal.tsx | Defaulted `addresses` argument passed to `useAbiMultiFetch` to empty string if falsy to ensure a string input. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant User
participant WebhookForm
participant ValidationSchema
User->>WebhookForm: Submit form with address fields (may be empty)
WebhookForm->>ValidationSchema: Validate addresses, fromAddresses, toAddresses
alt Field is empty or undefined
ValidationSchema-->>WebhookForm: Accept as valid (no error)
else Field has input
ValidationSchema->>ValidationSchema: Check if all tokens are valid addresses
alt All tokens valid
ValidationSchema-->>WebhookForm: Accept as valid
else
ValidationSchema-->>WebhookForm: Return error (invalid addresses)
end
end
WebhookForm-->>User: Show success or error messages Possibly related PRs
Suggested reviewers
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7294 +/- ##
=======================================
Coverage 55.57% 55.57%
=======================================
Files 909 909
Lines 58673 58673
Branches 4158 4158
=======================================
Hits 32607 32607
Misses 25959 25959
Partials 107 107
🚀 New features to boost your workflow:
|
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx
(2 hunks)apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/webhookTypes.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/webhookTypes.ts (1)
packages/thirdweb/src/exports/thirdweb.ts (1)
isAddress
(308-308)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Unit Tests
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/webhookTypes.ts (2)
37-50
: LGTM! Validation logic correctly handles optional addresses.The validation properly allows empty values and validates addresses only when provided. The error message clearly communicates the optional nature.
60-73
: LGTM! Validation logic is consistent with the addresses field.The validation properly handles optional values and maintains consistency with the
addresses
field validation pattern.apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx (2)
195-195
: LGTM! UI correctly reflects optional field status.Removing the required asterisk properly aligns with the validation schema changes that make contract addresses optional.
285-285
: LGTM! UI correctly reflects optional field status.Removing the required asterisk properly aligns with the validation schema changes that make the to address field optional.
...board/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/webhookTypes.ts
Outdated
Show resolved
Hide resolved
size-limit report 📦
|
ebd415e
to
da9ceef
Compare
da9ceef
to
340a10b
Compare
340a10b
to
a176c4d
Compare
Merge activity
|
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on improving the handling of contract addresses in the `CreateWebhookModal` and `FilterDetailsStep` components, as well as refining validation logic for addresses in `webhookTypes.ts`. It enhances user experience by clarifying requirements and allowing optional inputs. ### Detailed summary - In `CreateWebhookModal.tsx`, the `addresses` property now defaults to an empty string if not provided. - In `FilterDetailsStep.tsx`, the `FormLabel` for "Contract Addresses" and "To Address" no longer includes a required indicator. - Validation in `webhookTypes.ts` for `addresses`, `fromAddresses`, and `toAddresses` is updated to allow empty inputs and provide clearer error messages. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Removed the required field indicator from "Contract Addresses" and "To Address" labels in the form UI. - **New Features** - Updated form validation to allow "Contract Addresses", "From Address", and "To Address" fields to be optional and accept empty values, with improved error messages for clarity. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
a176c4d
to
62a3cd8
Compare
PR-Codex overview
This PR focuses on improving the handling of contract addresses in the
CreateWebhookModal
andFilterDetailsStep
components, as well as refining validation logic for address inputs in thewebhookTypes
utility file.Detailed summary
CreateWebhookModal.tsx
, changedaddresses
to default to an empty string if undefined.FilterDetailsStep.tsx
, removed asterisks fromFormLabel
for "Contract Addresses" and "To Address".webhookTypes.ts
, updated validation to allow optional addresses and improved error messages for invalid inputs.Summary by CodeRabbit
Bug Fixes
New Features