fix: full-graph new users render green + debounce topNodes slider#1721
fix: full-graph new users render green + debounce topNodes slider#1721
Conversation
- Change new user node color from blue to green to match legend - Debounce topNodes slider (500ms) to prevent refetch on every tick - Pass includeNewDays to backend so new users always appear regardless of topNodes filter
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughDebounced subsequent fetches were added to InvitesGraph (first fetch remains immediate); the component now passes an includeNewDays parameter to the invites graph API; node color for "new" activity changed to green; getInvitesGraph signature and query-building were updated to accept includeNewDays. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 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 unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/Global/InvitesGraph/index.tsx (1)
1136-1138: Extract the new-user fill color into shared graph constants.This PR fixes a legend mismatch with another inline RGBA literal, so the legend and node fill can drift again on the next palette tweak. Reuse a shared constant for both surfaces instead of hardcoding the value here.
As per coding guidelines, "Follow DRY (Don't Repeat Yourself) - reuse existing code and abstract shared functionality; use shared consts from src/constants".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/Global/InvitesGraph/index.tsx` around lines 1136 - 1138, Replace the hardcoded RGBA literal used when activityStatus === 'new' (where fillColor is set) with a shared constant exported from the shared constants module (create/export NEW_USER_FILL_COLOR or GRAPH_NEW_NODE_FILL there); update the import in this component and any legend code to reference that same exported constant so both node fill and legend reuse the identical value instead of duplicating the literal (search for activityStatus, fillColor, and the legend rendering to change usages).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/Global/InvitesGraph/index.tsx`:
- Around line 858-863: The effect that calls pointsApi.getInvitesGraph (passing
includeNewDays: activityFilter.activityDays) only depends on
apiKey/mode/topNodes so changes to activityFilter.activityDays don't trigger a
refetch; update the useEffect dependency arrays that invoke getInvitesGraph
(references: getInvitesGraph, includeNewDays, pointsApi, topNodes, apiKey, mode,
password) to include activityFilter.activityDays so the graph is refetched
whenever the activity window changes (apply the same change to the other similar
effect block that covers lines 874-887).
---
Nitpick comments:
In `@src/components/Global/InvitesGraph/index.tsx`:
- Around line 1136-1138: Replace the hardcoded RGBA literal used when
activityStatus === 'new' (where fillColor is set) with a shared constant
exported from the shared constants module (create/export NEW_USER_FILL_COLOR or
GRAPH_NEW_NODE_FILL there); update the import in this component and any legend
code to reference that same exported constant so both node fill and legend reuse
the identical value instead of duplicating the literal (search for
activityStatus, fillColor, and the legend rendering to change usages).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 54643109-4876-448c-92cf-6a58bb1a806d
📒 Files selected for processing (2)
src/components/Global/InvitesGraph/index.tsxsrc/services/points.ts
| // Pass includeNewDays so backend always includes recent signups regardless of topNodes | ||
| const result = await pointsApi.getInvitesGraph(props.apiKey, { | ||
| mode: apiMode, | ||
| topNodes: topNodes > 0 ? topNodes : undefined, | ||
| includeNewDays: activityFilter.activityDays, | ||
| password: mode === 'payment' ? props.password : undefined, |
There was a problem hiding this comment.
Refetch when the activity window changes.
includeNewDays now comes from activityFilter.activityDays, but this effect still only re-runs for apiKey/mode/topNodes. With topNodes > 0, a saved non-default activity window—or changing the window after mount—keeps the request pinned to the old includeNewDays, so some "new" users never get fetched until topNodes changes.
🛠️ Minimal fix
- }, [isMinimal, !isMinimal && props.apiKey, mode, topNodes])
+ }, [isMinimal, !isMinimal && props.apiKey, mode, topNodes, activityFilter.activityDays])Also applies to: 874-887
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/Global/InvitesGraph/index.tsx` around lines 858 - 863, The
effect that calls pointsApi.getInvitesGraph (passing includeNewDays:
activityFilter.activityDays) only depends on apiKey/mode/topNodes so changes to
activityFilter.activityDays don't trigger a refetch; update the useEffect
dependency arrays that invoke getInvitesGraph (references: getInvitesGraph,
includeNewDays, pointsApi, topNodes, apiKey, mode, password) to include
activityFilter.activityDays so the graph is refetched whenever the activity
window changes (apply the same change to the other similar effect block that
covers lines 874-887).
Use displaySettingsRef to read current activityFilter.activityDays so includeNewDays always reflects the latest value without adding activityFilter to the useEffect dependency array.
fef756c to
3d42b95
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| } else { | ||
| if (topNodesDebounceRef.current) clearTimeout(topNodesDebounceRef.current) | ||
| topNodesDebounceRef.current = setTimeout(fetchData, 500) | ||
| } |
There was a problem hiding this comment.
Debounce applies to all dependency changes, not just topNodes
Low Severity
The isInitialFetchRef gate applies the 500ms debounce to every dependency change (mode, apiKey, isMinimal, topNodes) after the first fetch, but the intent is to debounce only topNodes slider drags. If mode or apiKey ever changed at runtime, the fetch would be needlessly delayed by 500ms. With current call sites these props are effectively constant, so the bug is latent, but the logic doesn't match the stated intent in the comment on line 874.


Summary
rgba(144, 168, 237)) to green (rgba(74, 222, 128)) to match the existing legend which already shows green for "New"includeNewDaysparam to backend so new users appear in the graph regardless of topNodes point rankingSafety
'active'for all nodes, never hits the green color pathminimalmode (all-pink) and different API endpoint (getUserInvitesGraph)Companion PR
Backend: peanutprotocol/peanut-api-ts —
fix/graph-createdAt-null-safety(addsincludeNewDaysbackend support + null safety)Test plan
/dev/full-graph, verify new users (within activity window) show as green circles/dev/payment-graphstill works normally (no green nodes)Note
Medium Risk
Touches graph data fetching cadence and the invites-graph API query contract (
includeNewDays), which could affect load behavior if the backend handling differs; UI-only color change is low risk.Overview
Improves the full invites graph fetch behavior by debouncing
topNodes-driven refetches (500ms) to avoid API spam while dragging the slider.Extends
pointsApi.getInvitesGraphand the graph request to send a newincludeNewDaysquery param so recent signups remain included even whentopNodeslimits results, and updates the activity-filter rendering so "new" users render green instead of blue.Written by Cursor Bugbot for commit 3d42b95. This will update automatically on new commits. Configure here.