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 fire empty updates when a pausable emitter is resumed #161269

Merged
merged 1 commit into from Sep 20, 2022

Conversation

roblourens
Copy link
Member

Noticed this because this code buffers context key change events, but sometimes none actually changed:

https://github.com/9at8/vscode/blob/0884315fc01e6a46927c36c662c41b19d1dbe0be/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.ts#L123-L141

The alternative would be to duplicate all of those same checks outside of the bufferChangeEvents call, which might lead to duplication but I can live with, but it doesn't seem like there is ever a reason to fire an empty update like this.

Copy link
Member

@jrieken jrieken left a comment

Choose a reason for hiding this comment

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

Looks like a good change but I wonder how we got there. The CKS shouldn't fire events when nothing changes, there are check like this one. @roblourens do you recall/know how the underlying event got triggered?

@roblourens
Copy link
Member Author

setContext was never called. We are just calling bufferChangeEvents but none of these checks pass so we don't actually do any work inside that callback.

https://github.com/9at8/vscode/blob/0884315fc01e6a46927c36c662c41b19d1dbe0be/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.ts#L123-L141

@roblourens roblourens merged commit e082d6c into main Sep 20, 2022
@roblourens roblourens deleted the roblou/literary-mastodon branch September 20, 2022 18:08
@github-actions github-actions bot locked and limited conversation to collaborators Nov 4, 2022
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.

None yet

3 participants