Skip to content

Paginate the grid and split click from double-click#9

Merged
GordonBeeming merged 2 commits into
mainfrom
gb/grid-pagination-click
Jun 9, 2026
Merged

Paginate the grid and split click from double-click#9
GordonBeeming merged 2 commits into
mainfrom
gb/grid-pagination-click

Conversation

@GordonBeeming

Copy link
Copy Markdown
Owner

Summary

  • Grid no longer caps at 400 rows — it pages in 200 more screenshots as you scroll the bottom, using a (captured_at, id) keyset cursor so the live indexer adding shots mid-scroll can't dupe or skip rows. On a 6000-shot index the grid previously only reached back ~2 weeks.
  • Single click now selects a thumbnail (panel stays up); double click copies and closes, matching Enter.
  • Adds the bug and new-feature issue forms, issue config, and FUNDING.yml carried over from the ide repo.

Test plan

  • swift build clean
  • swift test --filter ScreenshotStoreTests passes, including two new keyset-pagination tests (tie-on-timestamp walk + filtered-search paging)
  • Manual: open the panel with no query, scroll past the first ~200 → older shots keep loading back past 24 May
  • Manual: single-click moves the selection without copying; double-click copies the image and dismisses; Enter and arrow-key nav still work
  • GitHub: New Issue page renders the bug and new-feature forms

The panel capped results at 400 rows, so on a 6000-shot index the grid
only reached back about two weeks. It now pages in older screenshots as
you scroll, using a (captured_at, id) keyset cursor so the live indexer
adding new shots mid-scroll can't dupe or skip rows.

Single click now selects a thumbnail instead of copying; double click
copies and closes, matching Enter.

Also adds the bug and new-feature issue forms, issue config, and
FUNDING.yml carried over from the ide repo.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
@GordonBeeming GordonBeeming marked this pull request as ready for review June 9, 2026 22:20
Copilot AI review requested due to automatic review settings June 9, 2026 22:20

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request implements keyset pagination for screenshot search and recent views to support infinite scrolling in the UI. It introduces a Cursor struct, updates database queries in ScreenshotStore to filter by cursor, implements paging logic in SearchViewModel, and updates PanelContentView to trigger loadMore() on scroll. It also adds unit tests and GitHub templates. Feedback highlights two critical issues: first, loadMore() runs synchronously on the main actor, which blocks the main thread with database I/O and renders the isLoadingMore guard ineffective; second, the SQL query in ScreenshotStore.recent needs to explicitly order by id DESC as a tie-breaker alongside captured_at DESC to ensure deterministic keyset pagination and prevent skipping tied rows.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Sources/Vista/SearchViewModel.swift
Comment thread Sources/VistaCore/ScreenshotStore.swift Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec0feff2e0

ℹ️ 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".

Comment thread Sources/VistaCore/ScreenshotStore.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Vista’s screenshot grid to support keyset pagination (so the grid can scroll back through the full index without OFFSET-related duplication/skipping while new screenshots are inserted), adjusts thumbnail interaction to separate single-click selection from double-click primary action, and adds GitHub repository metadata files (issue forms + funding).

Changes:

  • Added (captured_at, id) keyset pagination support to ScreenshotStore.recent and ScreenshotStore.search, plus new pagination tests.
  • Updated the UI/view-model to load results in 200-row pages and trigger loadMore() when the trailing grid cell appears.
  • Split single-click (select only) from double-click (primary action) behavior in the grid, and added GitHub issue templates + FUNDING.yml.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/VistaCoreTests/ScreenshotStoreTests.swift Adds tests validating cursor-based paging for both recent() and filtered search() results.
Sources/VistaCore/ScreenshotStore.swift Introduces the pagination cursor and wires it into recent/search SQL query generation.
Sources/Vista/SearchViewModel.swift Switches initial loads to page size 200 and adds a loadMore() API and paging state.
Sources/Vista/PanelContentView.swift Adds infinite-scroll trigger on the trailing cell and separates single vs double click behavior.
.github/ISSUE_TEMPLATE/new-feature.yml Adds a “New feature” issue form.
.github/ISSUE_TEMPLATE/bug.yml Adds a “Bug report” issue form.
.github/ISSUE_TEMPLATE/config.yml Enables blank issues in GitHub issue creation UI.
.github/FUNDING.yml Adds funding links metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/VistaCore/ScreenshotStore.swift Outdated
Comment thread Sources/VistaCore/ScreenshotStore.swift
Address review feedback on #9:
- Add an id DESC tie-breaker to both pagination ORDER BY clauses so rows
  sharing a captured_at can't be skipped when a page boundary lands
  mid-tie. The cursor predicate already compares id; the sort now matches.
- Run loadMore's query off the main actor. The store's serial queue is
  shared with the indexer's upserts, so a synchronous read could block
  the main thread behind a write batch and jank the scroll that triggered
  it. The detached read appends on the main actor with a staleness guard
  so a query/reload mid-flight drops the now-stale page.
- Add a regression test for a tie group straddling the page boundary.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
@GordonBeeming GordonBeeming merged commit 6404032 into main Jun 9, 2026
4 checks passed
@GordonBeeming GordonBeeming deleted the gb/grid-pagination-click branch June 9, 2026 22:29
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