Repository navigation
Add already-added notice for secret approval links - #109
Conversation
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughExtends the E2E test helper to accept optional allowedHosts/allowedCapabilities and adds route logic to detect requested hosts/capabilities from approval links, rendering an "Already added" status when matches exist instead of showing the approval card. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant Route as AccountSecretsRoute
participant Data as SecretDataStore
participant UI as UIRenderer
User->>Route: Navigate to approval link (e.g. ?allowed-host=api.cloudflare.com&request=stale-token)
Route->>Route: Parse query params & normalize requested host/capability
Route->>Data: Read selected secret or approval state (allowedHosts / allowedCapabilities)
Route->>Route: Compare requested vs existing -> compute alreadyAddedNotice
alt Host or capability already present
Route->>UI: Render AlreadyAdded status (with per-item messages)
UI->>User: Display "Already added" status and hide approval controls
else Not present
Route->>UI: Render Approval card (pre-filled requested host/capability)
UI->>User: Display approval controls
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
🔎 Preview deployed: https://kody-pr-109.kentcdodds.workers.dev Worker: Mocks:
|
|
@cursoragent please address the failing typescript in CI |
Summary
Testing
|
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
| ))} | ||
| </ul> | ||
| </section> | ||
| ) : null} |
There was a problem hiding this comment.
Stale data notice shown during location change refresh
Low Severity
The alreadyAddedNotice section renders without checking isRefreshingForLocationChange, unlike approvalCard which is explicitly gated by it. During a navigation-triggered data refresh, selectedSecret and approval hold stale data from the previous page while currentHref already reflects the new URL. This means getAlreadyAddedNotice can match the new URL's allowed-host param against the old secret's allowed hosts, briefly flashing a misleading "Already added" notice for the wrong secret.




Summary
allowed-hostorcapabilityfrom the landing URL is already present on the secretTesting
npm run typechecknpm run test:e2e:installnpm run test:e2e -- e2e/account-secrets.spec.tsSummary by CodeRabbit
New Features
Tests
Chores