Repository navigation
Refactor diff loading to dispatcher - #452
Conversation
Makes the code a bit easier to reason about
…or-diff-loading-to-dispatcher
Now that we don't refresh all the time we have to be more careful about keeping these in sync
|
This is ready for review 🙇 |
|
There's an interesting (and maybe not a blocker) visual change that this introduces - you see the "no file selected" message flash on the diff view when switching between files (for small files, whether modified or deleted) before it's replaced with the diff contents. |
| * compared against HEAD if it's tracked, if not it'll be compared to an empty file meaning | ||
| * that all content in the file will be treated as additions. | ||
| */ | ||
| public static getWorkingDirectoryDiff(repository: Repository, file: WorkingDirectoryFileChange): Promise<Diff> { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| return GitProcess.execWithOutput(args, repository.path) | ||
| .then(this.diffFromRawDiffOutput) | ||
| } | ||
| /** |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| /** A component which renders a diff for a file. */ | ||
| export class Diff extends React.Component<IDiffProps, IDiffState> { | ||
| export class Diff extends React.Component<IDiffProps, void> { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| /** This shouldn't be called directly. See `Dispatcher`. */ | ||
| public _changeChangesSelection(repository: Repository, selectedFile: WorkingDirectoryFileChange | null): Promise<void> { | ||
| public async _changeChangesSelection(repository: Repository, selectedFile: WorkingDirectoryFileChange | null): Promise<void> { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
These changes are pretty great. Nice work ✨ Just a couple of questions - I think the "no file selected" flicker is the biggest one. |
Yeah, I thought about it and I think we're lacking a loading-diff state and corresponding view. I don't think we should deal with it in this PR though. Ideally I'd want a skeleton view of the diff so that it's not quite so jarring. |
…or-diff-loading-to-dispatcher
…com/desktop/desktop into refactor-diff-loading-to-dispatcher
|
Ready for re-review 🙇 |
| history: gitStore.history, | ||
| selection: state.selection, | ||
| changedFiles: state.changedFiles, | ||
| diff: state.diff, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| nullCommitmodel so we don't have to look it up