Skip to content

feat(storage-browser): cross-page search, configurable sorting scopes, caching, and progress#6957

Open
soberm wants to merge 9 commits intomainfrom
feat/storage-browser-cross-page-search
Open

feat(storage-browser): cross-page search, configurable sorting scopes, caching, and progress#6957
soberm wants to merge 9 commits intomainfrom
feat/storage-browser-cross-page-search

Conversation

@soberm
Copy link
Copy Markdown
Contributor

@soberm soberm commented Apr 15, 2026

Bullet summary

  • Fix hasNextPage to account for local pagination of search results
  • Add search result caching to avoid re-fetching from S3 on query changes
  • Add configurable search limit (default 10,000, customizable via search.limit)
  • Add onProgress callback for search batch progress reporting
  • Expose searchProgress state in LocationDetailView for UI feedback
  • Add hasNextLocalPage to usePaginate hook
  • Add cross-page sorting that applies to the full dataset before pagination
  • Add configurable sortScope prop with three modes: 'page', 'all', 'global'
  • Add comprehensive unit tests for all new functionality
  • Add E2E feature files for cross-page search and sort scenarios

Description of changes

1. Search improvements

createEnhancedListHandler now supports:

  • Caching — search results are cached by query key to avoid redundant S3 fetches when the user changes sort column/direction or navigates pages within the same search.
  • Configurable limit — a new search.limit option (default 10,000) caps the maximum number of items fetched across all continuation pages during a search.
  • Progress reporting — an onProgress callback fires after each S3 page is fetched, reporting { loaded, total? } so the UI can display a progress indicator.

2. Pagination fix

hasNextPage now correctly accounts for hasNextLocalPage — when search results span multiple local pages (i.e., more items than pageSize), the paginator reports additional pages even when there are no further S3 continuation tokens.

3. Cross-page sorting

New modules sortItems.ts and updates to useSort.ts enable sorting across the full loaded dataset before it is sliced by usePaginate. This means sorting is no longer limited to the items visible on the current display page.

4. Configurable sort scopes via sortScope prop

Three modes control how sorting interacts with pagination:

Mode Behavior
'page' (default) Sort only the current display page. This preserves backward compatibility with the existing behavior.
'all' Sort all currently loaded items before pagination, so page boundaries reflect the sorted order.
'global' Fetch all S3 pages (up to search.limit), cache the full result set, then sort the entire dataset. The first sort click triggers the fetch with progress reporting; subsequent sorts reuse the cache.

5. useDataTable integration

useDataTable detects when a cross-page sort is requested (sortScope !== 'page') and delegates sorting upstream to the enhanced list handler. For 'page' mode it falls back to local in-table sorting, maintaining full backward compatibility.

Validation

  • Unit tests — new and updated tests for createEnhancedListHandler (caching, limit, progress), usePaginate (hasNextLocalPage), useSort (scope modes), and sortItems (sort logic).
  • Integration testsuseDataTable tests covering delegation vs. local sort paths.
  • E2E feature files — Cucumber/Gherkin scenarios for cross-page search result pagination and cross-page sort behavior.
  • Manual verification — tested against a live S3 bucket with 1,000+ objects to confirm caching, progress reporting, and sort correctness.

Checklist

  • Does this PR conform to the Contributing Guidelines?
  • Does this PR include unit tests?
  • Does this PR include E2E tests?
  • Does this PR include a changeset?

…aching, and progress

- Fix hasNextPage to account for local pagination of search results
- Add search result caching to avoid re-fetching from S3 on query changes
- Add configurable search limit (default 10k, customizable via search.limit)
- Add onProgress callback for search batch progress reporting
- Expose searchProgress state in LocationDetailView for UI feedback
- Add hasNextLocalPage to usePaginate hook
- Add comprehensive unit tests for all new functionality
- Add E2E feature file for cross-page search scenarios
@soberm soberm requested a review from a team as a code owner April 15, 2026 15:50
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 15, 2026

⚠️ No Changeset found

Latest commit: a6d4611

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@soberm soberm changed the title feat(storage-browser): implement search with pagination feat(storage-browser): cross-page search, sorting, caching, and progress Apr 16, 2026
…limits

- Add cross-page-sort.feature with 7 E2E scenarios covering:
  - Sort by name ascending/descending
  - Sort by size and last modified columns
  - Changing sort column resets direction
  - Sort combined with search results
  - Sort direction toggle preservation
- Add sorting step definitions to storagebrowser.ts:
  - Click sort header by column label
  - Verify first table row name
  - Verify table name column sort order
  - Assert minimum table row count
- Bump size-limit thresholds for createStorageBrowser (130->131 kB)
  and StorageBrowser (154->155 kB) to accommodate sorting code
@soberm soberm changed the title feat(storage-browser): cross-page search, sorting, caching, and progress feat(storage-browser): cross-page search, configurable sorting scopes, caching, and progress Apr 21, 2026
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.

1 participant