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

WIP: Introduce StoreUpdateGate, for temporarily blocking store updates for its descendants #7

Closed
wants to merge 5 commits into from

Conversation

LPGhatguy
Copy link
Contributor

@LPGhatguy LPGhatguy commented May 7, 2018

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 the StoreUpdateGate will pass on any Rodux store updates, or instead swallow them. When shouldBlockUpdates returns to true when it was previously false, a single update will be dispatched to all children.

@@ -0,0 +1,107 @@
--[[
A limited, simple implementation of a GatedSignal with the addition of a
gated condition.
Copy link
Contributor Author

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.

@coveralls
Copy link

coveralls commented May 23, 2018

Coverage Status

Coverage increased (+0.6%) to 98.34% when pulling dc4f1e9 on update-blocker into d68b99e on master.

if self.props.shouldBlockUpdates then
self.stateAtLastBlock = self.realStore:getState()
else
self.mockStore.changed:fire(self.realStore:getState(), self.stateAtLastBlock)

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?

@LPGhatguy
Copy link
Contributor Author

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!

@LPGhatguy LPGhatguy closed this Jun 12, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 12, 2020
@ZoteTheMighty ZoteTheMighty deleted the update-blocker branch April 19, 2022 22:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Component to block updates below it temporarily
3 participants