-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Conditionally hide badge, fix loading state #3140
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 GitHub.
|
WalkthroughAdded a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant TrackSale
participant Redis
rect rgb(220,240,255)
Note over TrackSale: New flow (single-key)
Client->>TrackSale: POST /track-sale
TrackSale->>Redis: GET idempotencyKey
alt cached
Redis-->>TrackSale: cachedResponse
TrackSale-->>Client: return cachedResponse
else not cached
TrackSale->>TrackSale: process sale
TrackSale->>Redis: SET idempotencyKey -> response
TrackSale-->>Client: return new response
end
end
rect rgb(255,245,220)
Note over TrackSale: Old flow (dual-key, removed)
Client->>TrackSale: POST /track-sale
TrackSale->>Redis: MGET idempotencyKey_new, idempotencyKey_old
alt newKey found
Redis-->>TrackSale: cachedResponseNew
TrackSale-->>Client: return cachedResponseNew
else oldKey found
Redis-->>TrackSale: cachedResponseOld
TrackSale-->>Client: return cachedResponseOld
else not cached
TrackSale->>TrackSale: process sale
TrackSale->>Redis: SET idempotencyKey_new -> response
TrackSale-->>Client: return new response
end
end
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touchesβ Failed checks (1 warning)
β Passed checks (2 passed)
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
π Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro π Files selected for processing (4)
π§° Additional context usedπ§ Learnings (4)π Learning: 2025-10-15T01:05:43.266ZApplied to files:
π Learning: 2025-09-24T16:10:37.349ZApplied to files:
π Learning: 2025-06-18T20:23:38.835ZApplied to files:
π Learning: 2025-10-02T22:46:22.739ZApplied to files:
πͺ Biome (2.1.2)apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx[error] 208-209: Avoid using target="_blank" without rel="noopener" or rel="noreferrer". Opening external links in new tabs without rel="noopener" is a security risk. See the explanation for more details. (lint/security/noBlankTarget) π Additional comments (4)
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. Comment |
|
@coderabbitai full review |
β Actions performedFull review triggered. |
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 (4)
apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx(1 hunks)apps/web/app/(ee)/app.dub.co/embed/referrals/page.tsx(3 hunks)apps/web/lib/api/conversions/track-sale.ts(1 hunks)apps/web/lib/zod/schemas/program-embed.ts(1 hunks)
π§° Additional context used
π§ Learnings (3)
π Learning: 2025-10-15T01:05:43.266Z
Learnt from: steven-tey
Repo: dubinc/dub PR: 2958
File: apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx:432-457
Timestamp: 2025-10-15T01:05:43.266Z
Learning: In apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx, defer refactoring the custom MenuItem component (lines 432-457) to use the shared dub/ui MenuItem component to a future PR, as requested by steven-tey.
Applied to files:
apps/web/app/(ee)/app.dub.co/embed/referrals/page.tsxapps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx
π Learning: 2025-09-24T16:10:37.349Z
Learnt from: TWilson023
Repo: dubinc/dub PR: 2872
File: apps/web/ui/partners/partner-about.tsx:11-11
Timestamp: 2025-09-24T16:10:37.349Z
Learning: In the Dub codebase, the team prefers to import Icon as a runtime value from "dub/ui" and uses Icon as both a type and variable name in component props, even when this creates shadowing. This is their established pattern and should not be suggested for refactoring.
Applied to files:
apps/web/app/(ee)/app.dub.co/embed/referrals/page.tsx
π Learning: 2025-10-02T22:46:22.739Z
Learnt from: steven-tey
Repo: dubinc/dub PR: 2924
File: apps/web/lib/api/conversions/track-lead.ts:7-7
Timestamp: 2025-10-02T22:46:22.739Z
Learning: In apps/web/lib/api/conversions/track-lead.ts, lead events are cached in Redis for 5 minutes (keys: `leadCache:${customer.id}` and `leadCache:${customer.id}:${stringifiedEventName}`) to provide immediate data availability while Tinybird ingestion happens asynchronously. This caching pattern allows for async-only recording without breaking "wait" mode semantics.
Applied to files:
apps/web/lib/api/conversions/track-sale.ts
πͺ Biome (2.1.2)
apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx
[error] 208-209: Avoid using target="_blank" without rel="noopener" or rel="noreferrer".
Opening external links in new tabs without rel="noopener" is a security risk. See the explanation for more details.
Safe fix: Add the rel="noopener" attribute.
(lint/security/noBlankTarget)
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
π Additional comments (4)
apps/web/lib/api/conversions/track-sale.ts (1)
61-66: LGTM! Clean simplification of cache retrieval.The change from dual-key to single-key Redis cache lookup simplifies the idempotency logic while maintaining the same functionality. The code is now more straightforward and easier to maintain.
apps/web/app/(ee)/app.dub.co/embed/referrals/page.tsx (2)
2-2: LGTM! Correctly removed unused import.The Wordmark import is no longer needed since the loading placeholder no longer displays the powered-by badge unconditionally.
73-84: LGTM! Simplified loading placeholder UI.The changes appropriately update the loading state to reflect the conditional badge behavior. The placeholder width adjustment and simplified rewards section align with the new conditional rendering approach.
apps/web/lib/zod/schemas/program-embed.ts (1)
12-12: LGTM! Well-defined schema addition.The new
hidePoweredByBadgefield follows Zod conventions correctly with an appropriate default value offalse, ensuring backward compatibility (badge shows by default unless explicitly hidden).
Summary by CodeRabbit
New Features
Improvements
βοΈ Tip: You can customize this high-level summary in your review settings.