Skip to content

Enhance contenet management data perfetching performance #55

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 2, 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 9 commits August 2, 2025 18:47
- Implement loading of countries and languages in ContentManagementBloc
- Add SharedDataRequested event
- Extend ContentManagementState to include countries and languages data
- Implement fetchAll helper function for efficient data retrieval
- Add error handling for data loading operations
…er data request

- Inject countriesRepository and languagesRepository into SharedDataBloc
- Dispatch SharedDataRequested event after bloc initialization
- Update dependencies in App widget
- Remove background fetching mechanism for countries list
- Load all countries at once in CreateHeadlineBloc initialization
- Remove unnecessary country-related state properties from CreateHeadlineState
- Update CreateHeadlinePage to use pre-loaded countries list
- Remove _FetchNextCountryPage event and related handling
- Remove background fetching mechanism for countries list
- Load all countries at once in EditHeadlineBloc initialization
- Update EditHeadlineState to remove pagination-related variables
- Modify EditHeadlinePage to use a predefined list of countries
- Remove loading indicator and related logic from the dropdown
…ling

- Remove pagination and background fetching for countries and languages
- Load full lists of countries and languages at once
- Cache countries and languages in ContentManagementBloc
- Update CreateSourceBloc to use cached lists
- Simplify UI logic for dropdowns
- Remove pagination and background fetching for countries and languages
- Load full lists of countries and languages at once
- Cache countries and languages in ContentManagementBloc
- Update EditSourceBloc to use cached lists
- Simplify UI by removing loading indicators for dropdowns
…etching

- Add comments explaining the background data fetching mechanism for countries and languages
- Clarify the purpose of this mechanism in relation to UI consistency and DropdownButtonFormField limitations
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 refactored the content management section to enhance data pre-fetching performance. The primary change involves centralizing the fetching and caching of common, static data like countries and languages within the ContentManagementBloc. This allows other BLoCs, particularly those responsible for creating and editing headlines and sources, to receive this data pre-loaded, significantly simplifying their logic and improving overall application responsiveness by reducing redundant API calls and complex pagination handling in multiple places.

Highlights

  • Centralized Data Management: Implemented a new SharedDataRequested event and handler within ContentManagementBloc to pre-fetch and cache all active countries and languages. This centralizes the fetching of common dropdown data.
  • Streamlined BLoC Initialization: Modified CreateHeadlineBloc, CreateSourceBloc, EditHeadlineBloc, and EditSourceBloc to receive pre-fetched lists of countries and languages directly during their initialization, eliminating their previous responsibilities for fetching and paginating this data.
  • Reduced Complexity in Child BLoCs: Removed background data fetching logic, related state properties (e.g., countriesHasMore, languagesIsLoadingMore), and associated UI helper texts from the Create and Edit BLoCs and their respective views, simplifying their implementation.
  • Performance Improvement: By pre-fetching and caching frequently used data, the application reduces the number of API calls and simplifies data access patterns, leading to improved performance and responsiveness, especially for forms with many dropdowns.
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.

@fulleni fulleni merged commit 04cca94 into main Aug 2, 2025
1 check failed
@fulleni fulleni deleted the enhance-contenet-management-data-perfetching-performance branch August 2, 2025 18:24
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 refactors data fetching for dropdowns (countries, languages) by centralizing it in ContentManagementBloc for better performance. This is a great improvement to avoid redundant network calls on different screens.

My review focuses on ensuring the refactoring is complete and doesn't introduce regressions. I've found a few issues:

  • A potential bug in the edit screens where selected dropdown values might not be displayed correctly due to the refactoring.
  • Incorrect retry logic on the creation screen.
  • Some suggestions to improve code quality and maintainability in the new data fetching logic.

Overall, the direction is excellent, and with a few fixes, this will be a solid enhancement.

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