Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Conversation

@grokys
Copy link
Contributor

@grokys grokys commented Dec 5, 2017

This PR makes IPanePageViewModels get disposed when they are removed from a NavigationViewModel's history. It also adds Activated and Deactivated methods to IPanePageViewModel which are called when the page is moved to/away from in the navigator. NavigationViewModel.RegisterDispose has been removed as disposing of the view models should suffice.

It modifies PullRequestDetailViewModel to only refresh when the page is active. When not active, it simply sets a flag to refresh when the page is activated. This should prevent all pages in the GitHub pane history refreshing at once, which is an expensive operation.

Depends on #1346
Fixes #1360

- Remove `NavigationViewModel.RegisterDispose` and call `Dispose` on pages when they're removed from the history
- Add `Activated` and `Deactivated` methods to `IPanePageViewModel` which are called when the page is moved to/away from in the navigator
Rather than making derved classes implement it if necessary. This is to prevent them maybe forgetting to dispose subscriptions to it.
When a repository change is detected by a non-active `PullRequestDetailViewModel`, set a flag to refresh the view model when it becomes active again.
 Conflicts:
	src/GitHub.App/ViewModels/GitHubPane/PullRequestDetailViewModel.cs
Previously we were only clearing it when it changes to a new valid repository. Instead clear it if the TE context is cleared for example. We need to check that the repository is actually different here because `TeamExplorerRepositoryHolder` sometimes notifies a change when the repository has not changed.
Don't try to update the PR list filter when the collection has been disposed.
@grokys grokys changed the base branch from refactor/mvvm to master December 5, 2017 16:36
jcansdale and others added 3 commits December 5, 2017 18:16
We only want to check whether the repository has changed when we're getting the notification from `TeamExplorerRepositoryHolder` (as it sometimes signals a change when there is none) - in the case of a connection changing we _should_ update the content when the repository hasn't changed.
@meaghanlewis
Copy link
Contributor

LGTM. Tested this using VS2017 using the github/github repo.

Copy link

@drguthals drguthals left a comment

Choose a reason for hiding this comment

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

lgtm

@grokys grokys merged commit 2e1f640 into master Dec 18, 2017
@grokys grokys deleted the fixes/1360-dispose-pane-pages branch December 18, 2017 10:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants