Skip to content

Enhance content management dropdown fetching performance #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

fulleni
Copy link
Member

@fulleni fulleni commented Aug 1, 2025

Status

READY/IN DEVELOPMENT/HOLD

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

fulleni added 10 commits August 1, 2025 06:54
- Replace restartable() transformer with droppable() for search events
- Remove unnecessary line breaks in constructor initializers
- Simplify filter conditions in repository calls
- Merge language list update into a single line
- Add 'countriesIsLoadingMore' field to CreateHeadlineState
- Update copyWith method to include new field
- Modify state initialization to set default value for 'countriesIsLoadingMore'
…e requests

- Add countriesIsLoadingMore flag to state
- Check countriesIsLoadingMore before making new load more request
- Update state with countriesIsLoadingMore: true at the start of the request
- Reset countriesIsLoadingMore to false in both success and error cases
…e requests

- Add countriesIsLoadingMore flag to state
- Check countriesIsLoadingMore before making new load more request
- Update loading state in both success and error cases
- Add 'countriesIsLoadingMore' field to EditHeadlineState
- Update constructor and copyWith method to include new field
- Modify Equatable props to include 'countriesIsLoadingMore'
…nd languages

- Add countriesIsLoadingMore and languagesIsLoadingMore fields to CreateSourceState
- Update constructor, copyWith method, and properties list to include new loading indicators
- This change supports infinite scrolling functionality for country and language lists
…ies and languages

- Add loading flags for countries and languages
- Check loading flags before initiating new load requests
- Update loading flags appropriately during and after API calls
- Ensure proper UI feedback during loading states
…ies and languages

- Add loading flags for countries and languages
- Check loading flags before initiating new load requests
- Update loading flags appropriately during and after API calls
- Ensure proper UI feedback while loads are in progress
…nd languages

- Add countriesIsLoadingMore and languagesIsLoadingMore fields to EditSourceState
- Update constructor, copyWith method, and field list to include new loading indicators
- Add a check for loading state before triggering onLoadMore()
- Extract isLoadingExtractor from widget to avoid redundant calls
- Improve performance and prevent unnecessary API calls
@fulleni fulleni merged commit 3c7e8d1 into main Aug 1, 2025
1 check failed
@fulleni fulleni deleted the enhance-content-management-dropdown-fetching-performance branch August 1, 2025 06:52
Copy link

@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.

Summary of Changes

Hello @fulleni, 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!

I've implemented performance enhancements for content management dropdowns, specifically focusing on data fetching. The core changes involve optimizing how search and 'load more' events are handled to prevent redundant requests and improve responsiveness. This was achieved by switching to droppable event transformers for search queries and introducing explicit loading state flags to manage concurrent 'load more' operations, ensuring a smoother user experience when interacting with these dropdowns.

Highlights

  • Optimized Search Event Handling: I've updated the BLoC event transformers from restartable() to droppable() for search-related events in CreateHeadlineBloc, CreateSourceBloc, EditHeadlineBloc, and EditSourceBloc. This ensures that if a user types quickly into a search field, only the latest search query is processed, discarding any previous, slower requests, which significantly improves responsiveness and reduces unnecessary network calls.
  • Implemented Loading State Flags: I've introduced new isLoadingMore flags (e.g., countriesIsLoadingMore, languagesIsLoadingMore) within the state objects (CreateHeadlineState, CreateSourceState, EditHeadlineState, EditSourceState). These flags track whether a 'load more' operation for dropdown data is currently in progress, preventing multiple simultaneous requests.
  • Prevented Redundant 'Load More' Requests: I've added logic to the respective BLoCs to check these new isLoadingMore flags before initiating a new 'load more' request. This ensures that if a user rapidly scrolls to the bottom of a dropdown, only one data fetch is triggered at a time, preventing redundant API calls and improving performance.
  • Enhanced Dropdown Scroll-to-Load Logic: The SearchableDropdownFormField widget now utilizes the new isLoadingMore state. It will only attempt to load more data when the user scrolls to the bottom if there isn't already an active loading operation, making the dropdowns more robust and efficient.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 or fill out our survey to provide feedback.

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.

Copy link

@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 introduces several performance enhancements for dropdowns with search and load-more functionality. The addition of loading state flags (...IsLoadingMore) to prevent concurrent 'load more' requests is well-implemented and will improve the robustness of the UI. Similarly, preventing new 'load more' calls from the scroll listener while a request is in flight is a great addition.

However, I've identified a critical issue with the change from restartable() to droppable() for the search event transformers. While this may reduce the number of API calls, it introduces a functional regression where user input can be ignored, leading to a confusing search experience. I've left detailed comments with suggestions to revert this specific change in the affected BLoC files.

Other than that, the changes are solid and consistent across the codebase.

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