Skip to content

fix: replace accumulate-everything picker with page-based picker#243

Draft
bukinoshita wants to merge 3 commits intomainfrom
fix/page-based-picker-e9a3
Draft

fix: replace accumulate-everything picker with page-based picker#243
bukinoshita wants to merge 3 commits intomainfrom
fix/page-based-picker-e9a3

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Replaces the interactive ID picker with a page-based UI to prevent hangs on large accounts and cut memory/API usage. Integrates with the new pickItem/pickId flow from main and addresses Linear BU-617 by removing the unbounded “accumulate everything” pattern in pickId().

  • Bug Fixes
    • Keeps only the current page in memory; adds “Next page →” and “← Previous page” navigation.
    • Tracks cursor history for forward/back navigation without rescanning.
    • Stops auto-fetching when a filter yields no matches; shows an info message instead.
    • Reduces API calls and avoids unbounded CPU/memory growth.
    • Preserves PickerConfig; aligns with pickItem/pickId delegation and preserves labels via itemOptions; adds tests for navigation, filtering, cursor passing, and empty/optional states.

Written for commit 5215dac. Summary will update on new commits.

cursoragent and others added 2 commits April 9, 2026 17:48
Replace the unbounded allFetched accumulation pattern in pickId() with a
page-based approach that only keeps the current page in memory.

Key changes:
- Replace 'Fetch more...' with 'Next page' / 'Previous page' navigation
- Remove auto-fetch loop for filtered pickers with empty results
- Only current page items are rendered as options (no unbounded growth)
- Cursor history is tracked for page navigation without re-scanning
- Filtered pickers show an info message instead of silently draining

This prevents large accounts from experiencing hangs, high memory usage,
and excessive API calls when using interactive pickers.

Fixes: BU-617

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
@bukinoshita
Copy link
Copy Markdown
Member Author

@cubic-dev-ai can you review?

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai bot commented Apr 9, 2026

@cubic-dev-ai can you review?

@bukinoshita I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@bukinoshita
Copy link
Copy Markdown
Member Author

@cursor fix conflicts

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 13, 2026

Conflicts resolved. Here's what I did:

  • Merged origin/main into the feature branch, which introduced a new pickItem() function and PickedItem type that pickId() now delegates to
  • Resolved two conflicts in src/lib/prompts.ts:
    • Integrated the page-based navigation options (Next page → / ← Previous page) with the new itemOptions pattern from main that tracks item-to-label mappings
    • Updated fetchPage to return PickedItem (with id and label) instead of plain string, matching the new pickItem contract
  • Verified everything passes: 799 tests, typecheck, and lint all clean
Open in Web Open in Cursor 

Integrated page-based picker changes into the new pickItem/pickId
delegation pattern introduced on main. The fetchPage inner function
now returns PickedItem instead of string, and uses the itemOptions
pattern from main to populate the label field.

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants