Skip to content

Conversation

@nvshah
Copy link
Contributor

@nvshah nvshah commented Apr 18, 2025

Ensure BlocSelector rebuilds correctly when selector function is updated. Closes #4414


Status

READY


Breaking Changes

NO


Description

This PR addresses an issue in the BlocSelector widget where a rebuild was not triggered when the selector function itself changed. The fix ensures that when the selector function is updated, the widget will rebuild to reflect the new selector logic. This change improves the behavior of the BlocSelector widget, making it more reliable when used with dynamic selector functions.


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

Ensure BlocSelector rebuilds correctly when selector function is updated.
Closes felangel#4414
@felangel felangel added bug Something isn't working pkg:flutter_bloc This issue is related to the flutter_bloc package labels May 2, 2025
@felangel felangel changed the title fix(bloc): rebuild BlocSelector when selector changes fix(bloc): rebuild BlocSelector when selector changes May 2, 2025
@codecov
Copy link

codecov bot commented May 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (792f923) to head (4401bf6).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #4415   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           57        57           
  Lines         1635      1637    +2     
=========================================
+ Hits          1635      1637    +2     
Flag Coverage Δ
flutter_bloc 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Owner

@felangel felangel left a comment

Choose a reason for hiding this comment

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

LGTM thanks so much for the fix! 💙

@felangel felangel changed the title fix(bloc): rebuild BlocSelector when selector changes fix(flutter_bloc): rebuild BlocSelector when selector changes May 2, 2025
@felangel felangel merged commit 1f04aa8 into felangel:master May 2, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working pkg:flutter_bloc This issue is related to the flutter_bloc package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BlocSelector fails to rebuild on selector change, causing outdated state

2 participants