-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix online presence values getting reset #2601
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe transformation logic for social media handles and website URLs in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant updateOnlinePresenceAction
participant updateOnlinePresenceSchema
User->>updateOnlinePresenceAction: Submit online presence update
updateOnlinePresenceAction->>updateOnlinePresenceSchema: Validate input
updateOnlinePresenceSchema-->>updateOnlinePresenceAction: Transform fields (preserve undefined, validate website)
updateOnlinePresenceAction-->>User: Return response
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
) | ||
.refine( | ||
(data) => { | ||
return ( | ||
data.youtube || | ||
data.twitter || | ||
data.linkedin || | ||
data.instagram || | ||
data.tiktok | ||
); | ||
}, | ||
{ | ||
message: "At least one social platform is required.", | ||
}, |
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.
I don't think this is necessary, e.g. a partner should be able to clear out all values or update the website without adding any socials
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
🧹 Nitpick comments (1)
apps/web/lib/actions/partners/update-online-presence.ts (1)
44-48
: Minor formatting inconsistency.The Instagram transform uses multi-line formatting while others use single-line. Consider using consistent formatting for better readability.
- .transform((input) => - input === undefined - ? undefined - : sanitizeSocialHandle(input, "instagram"), - ), + .transform((input) => + input === undefined ? undefined : sanitizeSocialHandle(input, "instagram"), + ),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/lib/actions/partners/update-online-presence.ts
(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
apps/web/lib/actions/partners/update-online-presence.ts (1)
Learnt from: devkiran
PR: dubinc/dub#2177
File: apps/web/lib/api/links/bulk-create-links.ts:66-84
Timestamp: 2025-06-06T07:59:03.120Z
Learning: In apps/web/lib/api/links/bulk-create-links.ts, the team accepts the risk of potential undefined results from links.find() operations when building invalidLinks arrays, because existing links are fetched from the database based on the input links, so matches are expected to always exist.
🧬 Code Graph Analysis (1)
apps/web/lib/actions/partners/update-online-presence.ts (1)
apps/web/lib/social-utils.ts (2)
sanitizeWebsite
(48-64)sanitizeSocialHandle
(66-102)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (3)
apps/web/lib/actions/partners/update-online-presence.ts (3)
18-22
: LGTM! Correctly preserves undefined values.The transform logic now prevents
undefined
values from being processed bysanitizeWebsite
, which is crucial for the conditional spreading logic in the action that depends onundefined
checks.
26-28
: LGTM! Consistent transform pattern for social handles.All social media transforms correctly preserve
undefined
values using the same pattern, preventing unintended field resets.Also applies to: 32-34, 38-40, 52-54
67-74
: LGTM! Simplified schema refinement appropriately.Removing the requirement for at least one social platform handle aligns with the goal of allowing partial updates without resetting values. The website URL validation is retained appropriately.
Summary by CodeRabbit
Bug Fixes
Chores