Skip to content

Conversation

@Doezer
Copy link
Owner

@Doezer Doezer commented Feb 11, 2026

⚡ Bolt: Implement server-side filtering for user games

💡 What: Added support for filtering user games by status on the backend, and updated the frontend to request only the necessary games for the Library and Wishlist pages.

🎯 Why: The Library and Wishlist pages were fetching all user games (including hidden and wanted games for Library, and owned games for Wishlist) and filtering them on the client. This resulted in unnecessary data transfer and processing, especially for users with large collections.

📊 Impact: Significantly reduces the JSON payload size for GET /api/games when used in Library and Wishlist contexts. For a user with 1000 wanted games and 50 owned games, the Library page load payload is reduced by ~95%.

🔬 Measurement:

  1. Check network requests in Library page: GET /api/games?status=owned,completed,downloading should return only relevant games.
  2. Check network requests in Wishlist page: GET /api/games?status=wanted should return only wanted games.
  3. Verify Discover page still works correctly (fetches all games to filter hidden ones).
  4. Run backend tests npm test server/__tests__/api_routes.test.ts.

PR created automatically by Jules for task 3379833437833090869 started by @Doezer

Optimizes the fetching of user games by implementing server-side filtering for game statuses. This reduces the payload size for the Library and Wishlist pages, which previously fetched all games and filtered them on the client.

- Updates `IStorage` and implementations to support `statuses` array in `getUserGames`.
- Updates `GET /api/games` to parse `status` query parameter.
- Updates `LibraryPage` and `WishlistPage` to request specific statuses.
- Ensures backward compatibility for existing callers.

Co-authored-by: Doezer <11655673+Doezer@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Doezer, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors how user game data is fetched and filtered, moving the filtering logic from the client-side to the server-side for the Library and Wishlist pages. This change aims to optimize performance by reducing the payload size for API requests, particularly beneficial for users with extensive game collections, and ensures that only relevant data is transferred to the client.

Highlights

  • Server-Side Filtering for User Games: Implemented server-side filtering for the /api/games endpoint, allowing clients to request games based on their status (e.g., 'owned', 'wanted').
  • Client-Side Optimization: Updated the Library and Wishlist pages to leverage the new server-side filtering, significantly reducing the amount of data transferred and processed on the client.
  • Storage Layer Enhancement: Modified the getUserGames method in the storage layer (both in-memory and database implementations) to accept an optional array of statuses for filtering.
Changelog
  • client/src/pages/library.tsx
    • Modified useQuery to include a status query parameter for fetching games.
    • Removed client-side filtering logic for library games, relying on the API to return pre-filtered data.
  • client/src/pages/wishlist.tsx
    • Modified useQuery to include a status query parameter for fetching 'wanted' games.
    • Removed client-side filtering logic for wishlist games, relying on the API to return pre-filtered data.
  • server/tests/api_routes.test.ts
    • Updated a test case for /api/games to reflect the new getUserGames signature, passing undefined for the optional statuses parameter.
  • server/routes.ts
    • Added status to the destructured req.query in the /api/games endpoint handler.
    • Implemented logic to parse the comma-separated status query parameter into an array of strings.
    • Modified the call to storage.getUserGames to pass the newly parsed statuses array.
  • server/storage.ts
    • Imported inArray from drizzle-orm for database query filtering.
    • Updated the IStorage interface to include an optional statuses parameter in the getUserGames method signature.
    • Modified the MemStorage implementation of getUserGames to filter games based on the provided statuses array.
    • Modified the DatabaseStorage implementation of getUserGames to use inArray for filtering games by status in the database query.
Activity
  • PR created automatically by Jules for task 3379833437833090869, started by @Doezer.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

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

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 effectively implements server-side filtering for user games, which is a significant performance enhancement. The frontend pages are correctly updated to leverage this new API feature, reducing data transfer and client-side processing. The backend logic in server/routes.ts and server/storage.ts correctly implements the filtering, and the tests are updated to match. I have one suggestion to improve the robustness of the query parameter parsing on the server.

Comment on lines +429 to +435
let statuses: string[] | undefined;
if (typeof status === "string" && status.trim().length > 0) {
statuses = status
.split(",")
.map((s) => s.trim())
.filter((s) => s.length > 0);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation for parsing the status query parameter only handles a single comma-separated string. It would be more robust to handle cases where statuses are provided as multiple query parameters (e.g., ?status=owned&status=completed), which Express parses as an array. This can be generalized to handle both strings and arrays of strings, including comma-separated values within them.

        let statuses: string[] | undefined;
        if (status) {
          const statusValues = Array.isArray(status) ? status : [status];
          statuses = statusValues
            .flatMap((s) => String(s).split(","))
            .map((s) => s.trim())
            .filter((s) => s.length > 0);
          if (statuses.length === 0) {
            statuses = undefined;
          }
        }

Optimizes the fetching of user games by implementing server-side filtering for game statuses. This reduces the payload size for the Library and Wishlist pages.

- Updates `IStorage` and implementations to support `statuses` array in `getUserGames`.
- Updates `GET /api/games` to parse `status` query parameter.
- Updates `LibraryPage` and `WishlistPage` to request specific statuses.
- Adds comprehensive tests for storage implementations and API routes.

Co-authored-by: Doezer <11655673+Doezer@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.

1 participant