Skip to content

CS-10380: Fetch type picker options from _federated-types endpoint#4171

Open
FadhlanR wants to merge 9 commits intomainfrom
cs-10380-fetch-type-picker-options
Open

CS-10380: Fetch type picker options from _federated-types endpoint#4171
FadhlanR wants to merge 9 commits intomainfrom
cs-10380-fetch-type-picker-options

Conversation

@FadhlanR
Copy link
Contributor

@FadhlanR FadhlanR commented Mar 12, 2026

Screen.Recording.2026-03-16.at.13.11.49.mov

Summary

  • Fetch type picker options from the _federated-types endpoint instead of deriving them from search results
  • Move loading indicators and infinite scroll behavior from the host TypePicker into the boxel-ui Picker component
  • Split type loading into two distinct states: full overlay for initial/search fetches, bottom spinner for load-more pagination
  • Implement server-side search and pagination for type picker options (page size: 25)
  • Types with the same display name but different code refs are merged into a single picker option

Changes

packages/boxel-ui/addon/src/components/picker/index.gts

  • Added isLoading, isLoadingMore, hasMore, onLoadMore args to Picker
  • Built-in PickerAfterOptions component with full overlay loading for initial/search and bottom spinner for load-more
  • Scroll-based infinite scroll detection with immediate check via requestAnimationFrame
  • dropdownClass adds --loading modifier for z-index layering (search input stays above overlay)

packages/host/app/components/type-picker/index.gts

  • Now passes @isLoading, @isLoadingMore, @hasMore, @onLoadMore directly to Picker

packages/host/app/components/card-search/panel.gts

  • Added fetchTypeSummaries restartable task calling realmServer.fetchCardTypeSummaries()
  • Resource-based reactivity: realm URL or search key changes trigger re-fetch automatically
  • Split loading into _isLoadingTypes (initial/search) and _isLoadingMoreTypes (pagination)
  • _typeCodeRefs map tracks multiple code refs per display name for accurate search filtering

packages/host/app/components/card-search/search-bar.gts

  • Added isLoadingTypes arg, passed through to TypePicker

Tests

  • Updated type counts and added waitFor for paginated type options in operator-mode UI tests

Test plan

  • Open type picker — verify loading indicator shows during initial fetch
  • Type in type picker search — verify loading overlay covers options area (not search input)
  • Scroll to bottom of type options — verify more types load with bottom spinner
  • Select a realm filter — verify type options refresh from the endpoint
  • Select specific type(s) — verify card search results filter correctly
  • Run packages/host integration tests for operator-mode UI

🤖 Generated with Claude Code

FadhlanR and others added 2 commits March 12, 2026 15:25
Instead of deriving type picker options from search results and recent
cards, fetch all available types from the _federated-types endpoint so
the picker is populated with all types across selected realms regardless
of search state.

Types with the same display_name but different code_refs appear as one
picker option, but all associated code_refs are used when filtering
search results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 12, 2026

@github-actions
Copy link

github-actions bot commented Mar 12, 2026

Host Test Results

    1 files  ±0      1 suites  ±0   2h 31m 48s ⏱️ + 1m 4s
2 021 tests +1  2 006 ✅ +1  15 💤 ±0  0 ❌ ±0 
2 036 runs  +1  2 021 ✅ +1  15 💤 ±0  0 ❌ ±0 

Results for commit b645670. ± Comparison against base commit 0da90e3.

This pull request removes 3 and adds 4 tests. Note that renamed tests count towards both.
Chrome ‑ Integration | operator-mode | ui: empty state shows no type options besides Any Type
Chrome ‑ Integration | operator-mode | ui: type options derived from recent cards when no search term, sorted alphabetically
Chrome ‑ Integration | operator-mode | ui: type options update when search term changes and deduplicate
Chrome ‑ Integration | operator-mode | ui: type options derived from realm types when no search term, sorted alphabetically
Chrome ‑ Integration | operator-mode | ui: type options show all realm types even without recent cards
Chrome ‑ Unit | last-modified-date: switches to relative time after one minute
Chrome ‑ Unit | last-modified-date: treats files from the last minute as just now

♻️ This comment has been updated with latest results.

FadhlanR and others added 7 commits March 12, 2026 20:54
- Add built-in infinite scroll and loading indicators to the boxel-ui
  Picker component (isLoading, isLoadingMore, hasMore, onLoadMore args)
- Full overlay loading covers options area during initial/search fetch,
  bottom spinner shows during load-more pagination
- Simplify TypePicker by removing custom afterOptionsComponent,
  infiniteScroll modifier, and pickerExtra - now passes args directly
- Split _typeSummariesLoading into _isLoadingTypes and
  _isLoadingMoreTypes for distinct loading states
- Update tests for pagination (waitFor specific types) and type count

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FadhlanR FadhlanR marked this pull request as ready for review March 16, 2026 08:05
@FadhlanR FadhlanR requested a review from a team March 16, 2026 08:05
Copy link

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

Choose a reason for hiding this comment

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

💡 Codex Review

const validIds = new Set(seen.keys());
const kept = prev
.filter((opt) => opt.type !== 'select-all' && validIds.has(opt.id))
.map((opt) => seen.get(opt.id)!);
value.selected = kept.length > 0 ? kept : [];

P1 Badge Preserve selections across server-side type searches

When the picker is using server-side search, this branch drops any previously selected type whose label is not present in the currently returned option set, so selecting Pet and then searching for Person clears Pet as soon as the filtered response arrives. That makes multi-select across different search terms impossible and unexpectedly reverts users back toward Any Type without an explicit deselect action.

ℹ️ 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 on lines +289 to +292
if (!codeRefsByDisplayName.has(name)) {
codeRefsByDisplayName.set(name, []);
}
codeRefsByDisplayName.get(name)!.push(codeRef);

Choose a reason for hiding this comment

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

P2 Badge Merge type code refs beyond the current paged slice

The typeCodeRefs map is built only from _typeSummariesData, which is fetched in 25-item pages, so a selected display name can end up mapped to only the code refs from already-loaded pages. In multi-realm or large-type sets, cards whose same display name appears on later pages get filtered out incorrectly because their code refs were never added to this map.

Useful? React with 👍 / 👎.

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