Skip to content

Refactor diff loading to dispatcher - #452

Merged
joshaber merged 30 commits into
masterfrom
refactor-diff-loading-to-dispatcher
Oct 5, 2016
Merged

joshaber merged 30 commits into
masterfrom
refactor-diff-loading-to-dispatcher

Conversation

@niik

@niik niik commented Sep 30, 2016 •

Copy link
Copy Markdown
Member
  • Move diff loading out of the Diff component
  • Split diff loading into two method (working directory and commit, analog to changes and history) so that we can get rid of | null
  • Make history diff accept a string instead of a Commit model so we don't have to look it up

niik added 24 commits September 30, 2016 17:44
Makes the code a bit easier to reason about
Now that we don't refresh all the time we have to be more careful about
keeping these in sync
@niik niik changed the title [WIP] Refactor diff loading to dispatcher Refactor diff loading to dispatcher Oct 4, 2016
@niik

niik commented Oct 4, 2016

Copy link
Copy Markdown
Member Author

This is ready for review 🙇

@shiftkey

shiftkey commented Oct 4, 2016 •

Copy link
Copy Markdown
Member

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.

return GitProcess.execWithOutput(args, repository.path)
.then(this.diffFromRawDiffOutput)
}
/**

This comment was marked as spam.

Comment thread app/src/ui/diff/index.tsx

/** 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 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.

This comment was marked as spam.

This comment was marked as spam.

@shiftkey

shiftkey commented Oct 5, 2016

Copy link
Copy Markdown
Member

These changes are pretty great. Nice work ✨

Just a couple of questions - I think the "no file selected" flicker is the biggest one.

@niik

niik commented Oct 5, 2016

Copy link
Copy Markdown
Member Author

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.

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.

@niik

niik commented Oct 5, 2016

Copy link
Copy Markdown
Member Author

Ready for re-review 🙇

@joshaber joshaber self-assigned this Oct 5, 2016

@joshaber joshaber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤘

history: gitStore.history,
selection: state.selection,
changedFiles: state.changedFiles,
diff: state.diff,

This comment was marked as spam.

@joshaber
joshaber merged commit 0ec25f6 into master Oct 5, 2016
@joshaber
joshaber deleted the refactor-diff-loading-to-dispatcher branch October 5, 2016 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants