-
Notifications
You must be signed in to change notification settings - Fork 32
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
WIP: Introduce StoreUpdateGate
, for temporarily blocking store updates for its descendants
#7
Conversation
lib/GatedSignal.lua
Outdated
@@ -0,0 +1,107 @@ | |||
--[[ | |||
A limited, simple implementation of a GatedSignal with the addition of a | |||
gated condition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, that comment got butchered by find-and-replace.
lib/StoreUpdateGate.lua
Outdated
if self.props.shouldBlockUpdates then | ||
self.stateAtLastBlock = self.realStore:getState() | ||
else | ||
self.mockStore.changed:fire(self.realStore:getState(), self.stateAtLastBlock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this check if the oldState ~= newState before firing? Does Rodux itself do this?
I believe we have concluded internally that this functionality is hard to implement correctly and is of dubious utility. As such, I'm closing this PR! |
Closes #6.
Introduces a new component named
StoreUpdateGate
(name subject to change) that exposes a mock store for all connections below it in the tree.The prop
shouldBlockUpdates
(name also subject to change) determines whether theStoreUpdateGate
will pass on any Rodux store updates, or instead swallow them. WhenshouldBlockUpdates
returns totrue
when it was previouslyfalse
, a single update will be dispatched to all children.