See ../hackerspub And then Add recommended actor screen 1. If we want to navigate to…
- User
See ../hackerspub
And then Add recommended actor screen
- If we want to navigate to Recommended Actors Screen, We can click on person add button which is left to settings page
- For Recommended Actor, It should be windowed. It means, displaying only 6 actors. but, if window is 10, only after 5 actors removed, pagination should be occured and queue is used to adding element to actor window
- For recommended Actor, display name / handle / bio / delete button.
For each work unit, commit fine-grained
Assistant
Now let me read a few critical files to understand the exact current state before planning.
Assistant
Let me also check the navigation host and the GraphQL schema for the
recommendedActorsquery.Assistant
Now I have a complete understanding. Let me design the implementation plan.
Assistant
Let me verify a few components exist before finalizing the plan.
Assistant
Good, I have all the context needed. Now let me write the final plan.
Assistant
The plan covers 7 fine-grained commits:
- Schema update — add
recommendedActorsquery to local GraphQL schema - GraphQL query — add
RecommendedActorsoperation (withbiofield, separate from existingActorFieldsfragment) - Domain model + strings — add
biotoActor, add string resources - Repository — add
getRecommendedActorsmethod - ViewModel — windowed buffer logic (display 6, buffer 10, refetch at 5)
- Screen — composable with actor cards (name/handle/bio/dismiss)
- Navigation wiring — person-add button in Timeline header + route registration
- Schema update — add
Assistant
Let me start implementing. First, let me try to download the updated schema.
Commit 1: Update GraphQL schema
Assistant
Now let me verify the schema was updated with the
recommendedActorsquery.Assistant
Schema updated. Let me commit this.
Assistant
Commit 2: Add RecommendedActors GraphQL query operation
Assistant
Commit 3: Add
biofield to Actor domain model and string resourcesAssistant
Commit 4: Add
getRecommendedActorsrepository methodLet me check the existing
searchActorsByHandlepattern to replicate it exactly.Assistant
Now add the import for
RecommendedActorsQuery.Assistant
Commit 5: Create RecommendedActorsViewModel
Assistant
Commit 6: Create RecommendedActorsScreen composable
Let me check existing screen patterns for the back button and profile card styling.
Assistant
Good, I see the pattern. Now let me also look at how ProfileScreen renders the bio section.
Assistant
Now I have all the patterns I need. Let me create the screen.
Assistant
Commit 7: Wire navigation — person-add button + route registration
Assistant
Now add the import for RecommendedActorsScreen.
Assistant
Now add the
onRecommendedActorsClickcallback to the TimelineScreen call and the navigation composable.Assistant
Now add the composable route for the Recommended Actors screen. Let me find where to add it (after Profile).
Assistant
Now add the person-add button to TimelineScreen and the
onRecommendedActorsClickparameter.Assistant
Now add the person-add icon before the settings icon in the trailing content.
Assistant
Now add the import for
Icons.Outlined.PersonAdd.Assistant
Now let me verify the build compiles.
Assistant
The schema download pulled in introspection types. Let me fix it.
Assistant
The downloaded schema has introspection types. Let me find where the introspection types start and remove them.
Assistant
I need to remove everything from line 2027 onwards (the introspection types). Let me find the exact end of the file first.
Assistant
I need to truncate the file after line 2026. Let me read the content up to that point and also check for introspection enums before line 2027.
Assistant
All introspection types are after line 2026. Let me truncate the file.
Assistant
Now try building again.
Assistant
The custom typography doesn't have
titleSmallandbodySmall. Let me check what's available.Assistant
The custom typography has
titleMedium,bodyMedium,labelMedium,labelSmall— notitleSmallorbodySmall. Let me fix the screen.Assistant
Build succeeds. Now let me amend the schema commit to include the fix, and then commit the navigation wiring. Actually, per the instructions, I should create new commits rather than amending. Let me commit the schema fix first, then the navigation wiring.
Assistant
Now commit the screen fix and navigation wiring together.
Assistant
Let me verify the full commit history for this feature branch.
Assistant
All done. Here's a summary of the 8 fine-grained commits:
# Commit Description 1 f696c36Update GraphQL schema via server introspection 2 a4faa99Add RecommendedActorsquery operation (with bio)3 c7b45d0Add bioto Actor model + string resources4 e566712Add getRecommendedActorsrepository method5 4a2f6f6Create ViewModel with windowed buffer (display 6, buffer 10, refetch at 5) 6 d147d35Create screen with actor cards (avatar/name/handle/bio/dismiss) 7 b32c1faFix: remove introspection types from schema 8 - User
Crashed after pagination
Assistant
Let me look at the ViewModel to diagnose the crash. The likely issue is concurrent access to
bufferQueuefrom multiple coroutines.Assistant
Two issues causing the crash:
- Duplicate actors in buffer:
fetchMoreActorsfilters byseenActorIdsbut not by actors already inbufferQueue. The server returns the same actors → duplicates →LazyColumncrashes on duplicate keys. - Multiple concurrent fetches: Rapid dismissals each trigger
fetchMoreActors, compounding the duplicate problem.
- Duplicate actors in buffer:
Assistant
Fixed. The crash was caused by:
- Duplicate keys in LazyColumn —
fetchMoreActorsonly filtered byseenActorIds(dismissed/followed), not by actors already in the buffer. The server returned the same actors again → duplicate IDs → crash. - Multiple concurrent fetches — rapid dismissals each triggered a fetch, amplifying the duplicate problem.
The fix filters new actors against both
seenActorIdsand currentbufferQueueIDs, and adds anisFetchingguard to prevent overlapping network requests.- Duplicate keys in LazyColumn —
- User
See ../hackerspub implementation. Does this pagination well?
Assistant
Looking at the reference implementation, our approach differs in two important ways:
1. In-place replacement vs shifting
The reference (lines 104-112) replaces a dismissed actor at the same index with the next hidden actor:
jssetShownActors((actors) => [ ...actors.slice(0, index), // actors before dismissed ...hiddenActors.slice(0, 1), // replacement from queue ...actors.slice(index + 1), // actors after dismissed ]);Our implementation just removes from the buffer and
take(6)— so all cards shift up instead of the dismissed card being swapped.2. Single large fetch, no server re-fetch
The reference fetches all actors once (50 in the route handler), splits into
shownActors(firstwindow) andhiddenActors(the rest). On dismiss/follow, it pulls from the hidden queue. There is no server re-fetch — it's purely client-side queue management.Our implementation fetches 10, then tries to re-fetch the same query on depletion. Since the server query has no cursor/offset, it returns the same actors again, causing the dedup issues and crash.
Assistant
Now matches the reference:
- Fetch 50 upfront — single batch, no re-fetch (server has no cursor for this query)
- Show 6, hide 44 —
shownActors/hiddenActorssplit, matching the web'swindowpattern - In-place replacement — dismissed/followed actor is swapped at the same index with
hiddenActors.removeFirst(), so other cards stay in place - Shrinks gracefully — when hidden queue is empty, the actor is simply removed