-
Notifications
You must be signed in to change notification settings - Fork 581
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
Reduce calls to updateState
in review manager
#482
Conversation
…or remotes have changed
&& oldHead.type === newHead.type | ||
&& sameUpstream; | ||
|
||
const sameRemotes = this._previousRepositoryState.remotes.length === this._repository.remotes.length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to filter out remotes created for PR purpose first so a fresh checkout will only lead to one updateState
, triggered by branch change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to hold off on making that change now, but I agree
src/view/reviewManager.ts
Outdated
|
||
if (!sameHead || !sameRemotes) { | ||
this._previousRepositoryState = { | ||
HEAD: Object.assign(this._repository.HEAD), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is object duplication necessary here? this._previousRepositoryState
will keep reference to the old HEAD
as when this._repository
status gets updated, we will create new objects for HEAD
and remotes
. Correct me if I miss any potential data leak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, you're right, no need to duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for reducing the status change handling. Only some tiny comments.
Check if
HEAD
andremotes
are the same before callingupdateState
. The equals check is a bit ugly, I didn't extract it out into a method because putting it inRepository
would add another thing for Joao to have to implementFixes #429