Skip to content
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

feat(bloc)!: add emit.onEach and emit.forEach to Cubit #4293

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

felangel
Copy link
Owner

Status

IN DEVELOPMENT

Breaking Changes

YES

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

@felangel felangel added pkg:bloc This issue is related to the bloc package breaking change Enhancement candidate would introduce a breaking change labels Nov 30, 2024
@felangel felangel self-assigned this Nov 30, 2024
@felangel felangel marked this pull request as ready for review November 30, 2024 20:45
@felangel felangel closed this Nov 30, 2024
@felangel felangel reopened this Nov 30, 2024
Copy link

codecov bot commented Nov 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4be2dcb) to head (e80e8bf).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #4293   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           31        30    -1     
  Lines          803       818   +15     
=========================================
+ Hits           803       818   +15     
Flag Coverage Δ
bloc 100.00% <100.00%> (ø)
replay_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.

@felangel felangel marked this pull request as draft November 30, 2024 20:48
@felangel felangel added the feedback wanted Looking for feedback from the community label Nov 30, 2024
@felangel
Copy link
Owner Author

felangel commented Jan 1, 2025

After thinking about this some more and chatting with more folks I don't feel this change provides a ton of value since the functionality in this implementation cancels any pending streams whenever emit.forEach/emit.onEach is used (regardless of the method it's used in). This differs from the bloc implementation since emit.forEach/emit.onEach is scoped to the event handler so emit.forEach in event handler A won't cancel the subscription for emit.forEach in event handler B. This isn't possible to due with Cubit (at least not with the current public API) and I don't think this change is worth it since I fear it won't solve real problems folks have and it'll lead to confusion since the API is named the same but functions differently across bloc and cubit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Enhancement candidate would introduce a breaking change feedback wanted Looking for feedback from the community pkg:bloc This issue is related to the bloc package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Add emitForEach / emitOnEach Methods (or something similar) to Cubit
1 participant