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

Fix Flatten when current_node is created after the flatten #139

Merged
merged 4 commits into from May 16, 2017

Conversation

JobJob
Copy link
Member

@JobJob JobJob commented May 15, 2017

Found a nice bug in flatten: When the flatten's current_node (the current value of the input Signal{Signal}) is created after the flatten, the flatten won't update when the current_node updates. This is because under normal circumstances, updates to that current_node will only propagate to nodes created after it. So simply having that node as a parent of the flatten, as per the existing implementation, didn't work.

The neat fix is to use bind! which I had previously taken care to handle an equivalent case - when the src node is downstream from (created after) the destination node.

N.b. only the last commit is relevant here. The first 3 commits are from #138 which should be merged before this.

@shashi
Copy link
Member

shashi commented May 16, 2017

Cool! 👍 The merged commits appear to be still here. I will squash-merge this.

@JobJob
Copy link
Member Author

JobJob commented May 16, 2017

Ok, I can rebase right now if that's easier

current_node = input.value
output.parents = (input, current_node)
bind!(output, current_node, false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads so nice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

@shashi shashi merged commit 2abf20b into master May 16, 2017
@shashi shashi deleted the job/flatten-bind-fix branch May 16, 2017 06:31
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.

None yet

2 participants