Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Fetch data with yubikiri - #565

Merged
BinaryMuse merged 15 commits into
masterfrom
mkt-data-fetch-with-yubikiri
Feb 27, 2017
Merged

BinaryMuse merged 15 commits into
masterfrom
mkt-data-fetch-with-yubikiri

Conversation

@BinaryMuse

Copy link
Copy Markdown
Contributor

This PR converts data fetching in components to use yubikri in order to more easily and correctly fetch data in parallel.

@BinaryMuse

Copy link
Copy Markdown
Contributor Author

@kuychaco @smashwilson This switches data fetching to use Yubikiri in all the controllers. Would love a quick review just to double check that I didn't mess something up.

Also fixed a few linter errors and a couple odd test behaviors.


if (data.remoteName) {
data.aheadCount = await repository.getAheadCount(data.branchName);
data.behindCount = await repository.getBehindCount(this.branchName);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I maintained data.branchName being passed to getAheadCount and this.branchName being passed to getBehindCount though I'm not certain why the calls use different values

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.

Huh. Offhand I'm pretty sure that's a 🐛 and they should both be data.branchName. 🤔

@smashwilson smashwilson 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.

Only one comment that you might want to take action on. Other than that looks great 😄


if (data.remoteName) {
data.aheadCount = await repository.getAheadCount(data.branchName);
data.behindCount = await repository.getBehindCount(this.branchName);

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.

Huh. Offhand I'm pretty sure that's a 🐛 and they should both be data.branchName. 🤔

aheadCount: async query => {
const remoteName = await query.remoteName;
return remoteName ? repository.getAheadCount(await query.branchName) : null;
},

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.

This is so neat 😁

.filter(remote => remote.info.githubRepo);
return {remotes, currentBranch, selectedRemote};
fetchData: repo => {
return yubikiri({

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.

Random thought: to be a little more declarative, it might be cool to have an alternative to fetchData that just accepts the yubikiri map directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hm, what would that look like? E.g. the values to the object would need to be repo.thing() but we have no repo

Comment thread test/controllers/git-controller.test.js Outdated
commandRegistry={commandRegistry}
notificationManager={notificationManager}
confirm={confirm}
tooltips={tooltips}

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.

Haha, I fixed this in #533 too.

view.mouseup();
assertEqualSets(view.selection.getSelectedItems(), new Set(unstagedChanges.slice(0, 2)));
assert.equal(view.props.didSelectFilePath.callCount, 0);
view.element.remove();

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.

💯

Comment thread lib/controllers/git-tab-controller.js Outdated
behindCount: async query => {
const remoteName = await query.remoteName;
return remoteName ? repository.getAheadCount(this.branchName) : null;
return remoteName ? repository.getAheadCount(await query.branchName) : null;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kuychaco We're pretty sure this was a bug, let us know if we were wrong ^_^

@BinaryMuse
BinaryMuse merged commit 4363460 into master Feb 27, 2017
@BinaryMuse
BinaryMuse deleted the mkt-data-fetch-with-yubikiri branch February 27, 2017 23:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants