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

Draft: 1250 safe effect #2392

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

Kirill486
Copy link

Q A
Fixed Issues? #1250 #1672 #2320
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? Yes
Tests Added + Pass? Red tests (TDD ready)
Any Dependency Changes? No

Closes: #1250

This Draft PR is created in order to discuss possible API change regards adding safe effect (see the corresponding issue).

The PR contains red tests on how the feature could work.

The proposal:

  1. The safe effect is defined once for the whole applications.
  2. There're special derivatives created for saga effects and saga helpers with the safe suffix that are wrapped in the safe effect under the hood: takeSafe, takeLatestSafe, takeLeadingSafe, takeEverySafe.
  3. Safe effect could be enhanced with custom behavior by providing additional arguments to the safe effect factory.
  4. Safe effect dispatches loading and error actions, so the state could be configured to store the loading and error flags.(the example will be add later)

Subjects to discuss:

  1. The api itself. The approach and possible edge cases.
  2. Are there any additional utilities that should be wrapped in the safe effect?
  3. What tests should be add to cover utilities: takeLatestSafe, takeLeadingSafe, takeEverySafe with tests?

@changeset-bot
Copy link

changeset-bot bot commented Sep 25, 2023

⚠️ No Changeset found

Latest commit: 412d049

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

Consider adding safe effect wrapper
1 participant