Skip to content

fix(precons): replace native type filter and handle catalog load failures#3602

Open
carlh7777 wants to merge 3 commits into
phase-rs:mainfrom
carlh7777:fix/precon-deck-modal
Open

fix(precons): replace native type filter and handle catalog load failures#3602
carlh7777 wants to merge 3 commits into
phase-rs:mainfrom
carlh7777:fix/precon-deck-modal

Conversation

@carlh7777

Copy link
Copy Markdown
Contributor

Summary

Fixes two user-facing issues in the Preconstructed Decks modal on Windows:

  1. Replaces the native deck type filter with the shared MenuSelect component to eliminate a rendering issue where a stray "All (0)" option could appear outside the dropdown.
  2. Improves deck catalog loading failure handling by surfacing a dedicated error state when decks.json cannot be loaded, preventing the UI from remaining indefinitely stuck on "Loading deck catalog...".

These changes improve consistency with the rest of the application and provide clearer feedback when deck data is unavailable.

Implementation Method (Required)

How was the engine/parser logic in this PR produced? Check exactly one:

  • Produced via the /engine-implementer pipeline (plan → review-plan → implement → review-impl → commit)
  • Not /engine-implementer — explain why below

Reason

This is a frontend-only UI and UX improvement.

  • Replaced the native SelectField implementation in PreconDeckModal with the existing shared MenuSelect component used elsewhere in the application.

  • Extended useDecks() to expose explicit loading and loadError states.

  • Updated modal rendering logic to distinguish between:

    • Catalog loading in progress
    • Successful catalog load
    • Catalog load failure

No gameplay systems, engine behavior, parser logic, rules processing, targeting, effect resolution, or networking logic were modified.

Note

Any change to crates/engine/ game logic — parser, effects, resolver, targeting, or rules behavior — is expected to go through /engine-implementer.

This PR only affects frontend presentation and error handling.

CR References

None.

The change is limited to UI presentation and client-side loading state management. No game rules, deck validation logic, or engine functionality were modified.

User Impact

Before

  • Windows users could observe a native select rendering artifact where a stray option appeared outside the dropdown.
  • If decks.json failed to load, the modal remained indefinitely in a loading state with no indication that an error had occurred.

After

  • The type filter uses the shared MenuSelect component, providing consistent cross-platform behavior.
  • Catalog loading failures are surfaced with a clear error message and actionable feedback instead of an endless loading indicator.

Verification

Automated

pnpm exec vitest run \
  src/components/menu/__tests__/MyDecks.test.tsx \
  src/pages/__tests__/GameSetupPage.test.tsx

Result: ✅ Pass

Manual Testing

  • Open My Decks → Preconstructed.
  • Verify the type filter renders via MenuSelect.
  • Confirm no floating or detached options appear on Windows.
  • Simulate a missing or failed decks.json request.
  • Verify the modal displays an explicit error state instead of remaining on "Loading deck catalog..." indefinitely.
  • Verify normal catalog loading behavior remains unchanged.

Screenshots

Before

image

After

image

…handling

- Replaced SelectField with MenuSelect for improved UI/UX in type filtering.
- Updated useDecks hook to return loading and error states.
- Enhanced PreconDeckModal to display loading and error messages based on the state.
- Added type filter label and options using useMemo for performance optimization.
- Updated translations for loading and error messages in multiple languages.
@carlh7777 carlh7777 requested a review from matthewevans as a code owner June 17, 2026 15:02

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

Copy link
Copy Markdown
Contributor

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 updates the useDecks hook to return loading and error states, replaces the SelectField with MenuSelect in PreconDeckModal, and adds corresponding loading and error UI states. The review feedback recommends refactoring the boolean flags (loading and loadError) to a single status enum ('loading' | 'success' | 'error') across the hook, components, and tests to comply with the repository's style guide rule against boolean fields (Rule R2).

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 client/src/hooks/useDecks.ts
Comment thread client/src/hooks/useDecks.ts
Comment thread client/src/components/menu/PreconDeckModal.tsx Outdated
Comment thread client/src/components/menu/PreconDeckModal.tsx Outdated
Comment thread client/src/components/menu/PreconDeckModal.tsx Outdated
Comment thread client/src/components/menu/__tests__/MyDecks.test.tsx Outdated
Comment thread client/src/pages/__tests__/GameSetupPage.test.tsx Outdated
…flags

- Updated useDecks hook to return a status string ("loading", "success", "error") for better state management.
- Modified PreconDeckModal and related tests to utilize the new status structure.
- Enhanced loading and error handling in PreconDeckModal for improved user experience.
@matthewevans

Copy link
Copy Markdown
Member

This is a frontend change (precons UI: native type filter replacement + catalog load-failure handling across client/src components/hooks/i18n/pages), which the maintainer reviews directly — UI behavior + the i18n key changes need a browser check and locale-parity verification the automated review loop can't do. Flagging for maintainer review; no engine/rules concerns from my side.

@matthewevans matthewevans added this pull request to the merge queue Jun 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2026
@matthewevans matthewevans added the bug Bug fix label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants