Skip to content

Fix included file race - #1263

Merged
iAmWillShepherd merged 12 commits into
masterfrom
inclusivity
Apr 24, 2017
Merged

iAmWillShepherd merged 12 commits into
masterfrom
inclusivity

Conversation

@joshaber

@joshaber joshaber commented Apr 21, 2017 •

Copy link
Copy Markdown
Contributor

Fixes #1248

The bug was:

  1. Start loading the selected file's diff.
  2. The file's includedness is changed.
  3. The diff loading completes, but still uses the previous includedness, effectively reverting it.

This is the second bug I've fixed around selectedFile due to the fact that it's essentially aliasing state we already have somewhere else (i.e., workingDirectory.files). So I refactored how we store the selected file. We now store its ID instead of storing the instance itself.

During that refactor, I found that _changeIncludeAllFiles method would have a similar bug. So I think getting rid of this state aliasing is a Very Good Thing. 🔥

@joshaber joshaber changed the title [WIP] Fix included file race Fix included file race Apr 21, 2017
@joshaber

Copy link
Copy Markdown
Contributor Author

This is ready for review 🦄

@iAmWillShepherd iAmWillShepherd self-assigned this Apr 21, 2017
selectedRow = this.props.workingDirectory.files.findIndex(file => file.id === selectedFile.id)
}

const selectedRow = this.props.workingDirectory.files.findIndex(file => file.id === this.props.selectedFileID)

This comment was marked as spam.

This comment was marked as spam.

@joshaber

Copy link
Copy Markdown
Contributor Author

🌉

@iAmWillShepherd
iAmWillShepherd merged commit 9bec19c into master Apr 24, 2017
@joshaber
joshaber deleted the inclusivity branch April 24, 2017 20:01
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.

2 participants