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

Improve migrating old editorAssociations setting format #126577

Merged
merged 2 commits into from Jun 17, 2021

Conversation

sandy081
Copy link
Member

This PR fixes #125970

  • Perform migration only from active window
  • Respect old format while reading the setting value

- respect old value while reading
@sandy081 sandy081 added this to the May 2021 Recovery milestone Jun 17, 2021
@sandy081 sandy081 self-assigned this Jun 17, 2021
Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

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

👍 Nice!

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

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

Minor nit: if the this.hostService.hadLastFocus() would move into convertOldAssociationFormat, we could also protect from the following case:

  • user has 10 windows opened
  • user manually changes settings in a way that we start the migration
  • all 10 windows start to migrate the setting at the same time

@lramos15
Copy link
Member

I'm not sure what the difference between last focus and focus is. Here is what I thought the change would look like.

		if (this.hostService.hasFocus) {
			this.convertOldAssociationFormat();
		}
		this.hostService.onDidChangeFocus((e) => {
			if (this.hostService.hasFocus) {
				this.convertOldAssociationFormat();
			}
		});

That way once any window gets focused we would convert the format. I would argue that since we convert so aggressively we should either call convertOldAssociationFormat() in the read if we somehow still read an old setting. We are duplicating the logic over into the read to be the same as update but if we always update on focus then it should never be the old setting.

@bpasero
Copy link
Member

bpasero commented Jun 17, 2021

We simply mimic what other code was already doing, like release notes that wants to open them only in the active window but not all windows, so we have a bit of confidence that that works:

hostService.hadLastFocus().then(async hadLastFocus => {

@sandy081
Copy link
Member Author

if the this.hostService.hadLastFocus() would move into convertOldAssociationFormat,

@bpasero Good point. Done 👍

@lramos15 Let me know if the changes are good. I will push then and we can trigger the builds.

@sandy081 sandy081 merged commit 507ce72 into release/1.57 Jun 17, 2021
@sandy081 sandy081 deleted the sandy081/recovery/fix125970 branch June 17, 2021 12:10
@microsoft microsoft deleted a comment from Stirfry70 Jun 22, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2021
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

4 participants