Spotlight: filter by guestsOnly (guest-only audience)#3238
Conversation
Match the new client model from vision-next #917: the card filters s.guestsOnly ? !username : !!username (logged-in by default; guestsOnly shows to signed-out visitors only). Bumps @ecency/sdk to ^2.3.11, which replaced the boolean auth with guestsOnly. Paired with the vapi guest funnel, signed-out users see the signup hooks and logged-in users never do.
Greptile SummaryThis PR updates the spotlight card audience filter from the deprecated
Confidence Score: 5/5Safe to merge — the change is a small, focused filter swap aligned with the new SDK type and the described backend model. The one-line filter change is correct for the new exclusive guest/logged-in audience model. The dismissal key derivation (id_guest vs id_username) is consistent before and after the change. The SDK bump is pinned to a specific patch release with a matching lockfile entry. The only open question is whether any existing backend spotlight records relied on the old show-to-everyone path, but that is a data/deployment concern outside this diff. No files require special attention. The core logic change is a single line in featureSpotlightCard.tsx. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[spotlightsQuery.data] --> B[Filter: platform includes 'mobile']
B --> C{s.guestsOnly?}
C -- true --> D{username defined?}
C -- false/undefined --> E{username defined?}
D -- yes logged-in --> F[Exclude]
D -- no guest --> G[Include]
E -- yes logged-in --> H[Include]
E -- no guest --> I[Exclude]
G --> J[Filter: not dismissed key = id_guest]
H --> K[Filter: not dismissed key = id_username]
J --> L[Pick highest weight / earliest start]
K --> L
L --> M[Render FeatureSpotlightCard]
Reviews (1): Last reviewed commit: "Spotlight: filter by guestsOnly (guest-o..." | Re-trigger Greptile |
| const candidates = (spotlightsQuery.data ?? []) | ||
| .filter((s) => !s.platforms || s.platforms.includes('mobile')) | ||
| .filter((s) => (s.auth === false ? true : !!username)) | ||
| .filter((s) => (s.guestsOnly ? !username : !!username)) |
There was a problem hiding this comment.
No "show to everyone" path in new model
The old filter had a third state: auth === false produced true, meaning a card was visible to both guests and logged-in users. The new filter is strictly exclusive — guestsOnly routes to either guests or logged-in users, never both. If the backend (vapi) never needs to broadcast a card to all audiences this is fine, but it's worth confirming that no existing spotlight records relied on that "universal" state during the data migration.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR updates the feature spotlight card filtering logic and bumps the SDK dependency. The spotlight selection now uses an explicit ChangesSpotlight Filtering and SDK Dependency
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ddfdf2cb5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const candidates = (spotlightsQuery.data ?? []) | ||
| .filter((s) => !s.platforms || s.platforms.includes('mobile')) | ||
| .filter((s) => (s.auth === false ? true : !!username)) | ||
| .filter((s) => (s.guestsOnly ? !username : !!username)) |
There was a problem hiding this comment.
Preserve auth:false for guest-visible spotlights
When the endpoint returns a spotlight in the existing auth: false format without guestsOnly, signed-out users now fail this predicate because guestsOnly is undefined and the code falls through to !!username. The previous behavior explicitly allowed those records to show to guests, so any guest-facing spotlight that has not been migrated to guestsOnly disappears from the anonymous feed; keep auth === false as a fallback while honoring guestsOnly for guest-only records.
Useful? React with 👍 / 👎.
Brings the mobile spotlight card in line with the new audience model (vision-next #917, vapi #30).
s.auth === false ? true : !!usernametos.guestsOnly ? !username : !!username- logged-in users by default,guestsOnlycards only to signed-out visitors.@ecency/sdkto^2.3.11, which replaced the booleanauthwithguestsOnlyon the Spotlight type.With the vapi guest funnel, signed-out users on the mobile feed see the signup hooks (and dismissing one reveals the next), while logged-in users only ever see the educational rotation. tsc + eslint clean.
Summary by CodeRabbit
Bug Fixes