Repository navigation
[Fork] Initial PullRequestCoordinator (P)refactor - #8825
Conversation
fed4c47 to
d5244af
Compare
d5244af to
d20dc9a
Compare
| export type RepositoryWithGitHubRepository = Repository & { | ||
| readonly gitHubRepository: GitHubRepository | ||
| } |
There was a problem hiding this comment.
One potentially controversial thing I've done is add a RepositoryWithGitHubRepository type which guarantees a Repository model has a GitHubRepository model in it. I did this primarily to make the null checks a little easier to read, since the PullRequestCoordinator is only be concerned with repositories that are connected to GitHub somehow, while AppStore and RepositoriesStore are concerned with all local repositories. This is kind of a band-aid for our domain model but that's a (long) story for another day.
tierninho
left a comment
There was a problem hiding this comment.
Tentative 👍 based on initial testing. Will continue exploratory testing on this in case there are any edge cases.
Majority of testing was done around the following:
- Loading of PRs on initial launch and as repo fetches over time
- Reliability of the PR refresh button
- Scouting for errors in background updating for PRs
niik
left a comment
There was a problem hiding this comment.
This looks great @outofambit, just one small question but overall this looks like a great prefactor.
|
|
||
| private startPullRequestUpdater(repository: Repository) { | ||
| if (this.currentPullRequestUpdater) { | ||
| this.stopPullRequestUpdater() |
There was a problem hiding this comment.
The removal of this stop operation from the startPullRequestUpdater method makes me a teeny bit nervous. I can' point towards anything that will break by removing this but given that pullRequestCoordinator.stopPullRequestUpdater is both cheap and idempotent could we maintain the current behavior just to be safe?
There was a problem hiding this comment.
ah I see. even though we do this in PullRequestCoordinator.startPullRequestUpdater, it might not get called! fixed in 8fb41ce
| this.stopPullRequestUpdater() | ||
| } | ||
|
|
||
| // We don't want to run the pull request updater when the app is in |
There was a problem hiding this comment.
Suggested change for the comment above about maintaining existing behavior.
| // We don't want to run the pull request updater when the app is in | |
| this.stopPullRequestUpdater() | |
| // We don't want to run the pull request updater when the app is in |
|
Addressed @niik's concerns, going to merge so I can get the next PR in this series ready for review |
supports #8549
Background
While discussing #8652, @niik and I agreed we needed an layer between
AppStoreand the workings ofPullRequestStoreandPullRequestUpdater. These relatively simple classes were getting bloated with additional logic and it felt like it would be easier to manage if there was something to contain that logic, outside ofAppStore.Description
This pull request begins this work by introducing this layer as
PullRequestCoordinator(at least that's what I'm calling it for now) but retaining the current application's behavior.Small Changes
One notable change is that the PullRequestCoordinator communicates with the AppStore in reference to a
Repository, not aGitHubRepositoryas it did previously. This small but significant change will allow the PullRequestCoordinator to compartmentalize concerns around matching remote GitHub repositories with local repositories.AppStore manages state for a single "selected" repository (the one currently in view in the UI), so this is a better fit for AppStore's concerns regardless.
Next Steps
Further changes to close #8549 will happen in future pull requests. They vast majority of these changes should be contained within the new
PullRequestCoordinator.