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

Don't onPropsChanged unless the old and new props are actually unequal. #887

Merged
merged 1 commit into from Jan 24, 2020

Conversation

zach-klippenstein
Copy link
Collaborator

@zach-klippenstein zach-klippenstein commented Jan 19, 2020

This looks like an optimization, but since most onPropsChanged are no-ops,
it's not really. This is to prevent code from starting to rely on the fact
that onPropsChanged is currently called on ever render pass. This is a small
step towards the behavior in #803, which lets WorkflowNodes skip a render
pass for their entire subtree when unnecessary. Making this change now will
help prevent code from being written that will break when that change lands.

The actual change is just surrounding three lines with an if, most of the changes in this PR are updates to tests.

This looks like an optimization, but since most `onPropsChanged` are no-ops,
it's not really. This is to prevent code from starting to rely on the fact
that `onPropsChanged` is currently called on ever render pass. This is a small
step towards the behavior in #803, which lets `WorkflowNode`s skip a render
pass for their entire subtree when unnecessary. Making this change now will
help prevent code from being written that will break when that change lands.
@zach-klippenstein zach-klippenstein added this to the kotlin v0.23.0 milestone Jan 19, 2020
@zach-klippenstein zach-klippenstein added this to Needs review in Workflow (Kotlin) via automation Jan 19, 2020
@zach-klippenstein
Copy link
Collaborator Author

Should manually test the Dungeon sample and make sure the time machine still works.

)

propsChannel.send("new props")
yield()
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe doc these yields?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will follow up.

@zach-klippenstein zach-klippenstein merged commit a643b94 into master Jan 24, 2020
Workflow (Kotlin) automation moved this from Needs review to Done Jan 24, 2020
@zach-klippenstein zach-klippenstein deleted the zachklipp/skip-onpropschanged branch January 24, 2020 01:13
@zach-klippenstein zach-klippenstein added the kotlin Affects the Kotlin library. label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kotlin Affects the Kotlin library.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants