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

Dispatch BAILOUT Event to Reducer when bailout function returns true. #149

Open
ABWalters opened this issue Sep 5, 2017 · 1 comment
Open

Comments

@ABWalters
Copy link

I currently have the following logic using this middleware.
state = { items: { itemID: itemObj, .... }, viewingItemID: itemID, }
Case 1:
'REQUEST' View Item> 'SUCCESS' Add new item to state -> Update viewingItemID to the item ID

OR

Case 2:
'REQUEST' View Item -> Bailout because View Item is already in the state (unable to update viewingItemID)

I then need to change the state's viewingItemID to the ID of the item the user would like to view .

However there is no action emitted to the reducer, so I cannot update the state after the bailout.

At the moment I get around this by dispatching actions 1: fetchItem, 2: setViewingItemID. However, this results in unnecessary state changes/react renders.

Would it be possible to add a bailout action that would be sent to the reducer?

Can I submit a pull request?

@wgottschalk
Copy link

wgottschalk commented Oct 20, 2017

I'm not a maintainer of the project but it looks like it's been brought up before:
#94

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

No branches or pull requests

2 participants