Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a94b679
:arrow_up: react(-dom)? and use the appropriate Enzyme adapter
smashwilson Apr 13, 2018
bfbe609
Disable lifecycle methods for shallow renders of CommitController
smashwilson Apr 13, 2018
b39c859
Compare numbers instead of strings
smashwilson Apr 13, 2018
6f9d74d
Apply .update() until it passes
smashwilson Apr 13, 2018
b2ca0b5
More .update(). MORE
smashwilson Apr 13, 2018
f4ee448
Use React Portals for PaneItem
smashwilson Apr 13, 2018
68f9400
native portals: Decoration
smashwilson Apr 13, 2018
d73775e
Use createItem to... create the item
smashwilson Apr 13, 2018
954024b
:art: spec name
smashwilson Apr 13, 2018
6a63bee
native portals: DockItem
smashwilson Apr 13, 2018
6ce6c0d
native portals: Panel
smashwilson Apr 13, 2018
5c89b9e
:fire: getItem
smashwilson Apr 13, 2018
752c9c2
Use RefHolders in CommitView
smashwilson Apr 13, 2018
42bb88a
Use RefHolders in the PushPullView and simplify Tooltip management
smashwilson Apr 13, 2018
c931f8d
Consume a RefHolder for the Tooltip target
smashwilson Apr 13, 2018
75cf8a3
Use a RefHolder for the Tooltip in StatusBarTileController
smashwilson Apr 13, 2018
1e4d262
Use ObserveModel component instead of decorator in status bar
smashwilson Apr 13, 2018
ad2d36f
Farewell <Portal>, you served us well
smashwilson Apr 16, 2018
e39752a
A RefHolder is like a burrito
smashwilson Apr 16, 2018
c710579
Move getCommitter() to Repository
smashwilson Apr 16, 2018
1ecdab8
Turns out target is a prop
smashwilson Apr 16, 2018
da221f2
Use a RefHolder within AtomTextEditor
smashwilson Apr 16, 2018
0be43d8
CommitView ref management
smashwilson Apr 16, 2018
225bf43
Update focus stubbing
smashwilson Apr 16, 2018
a92731f
Extract a child ref from BranchView
smashwilson Apr 16, 2018
c0ce85d
Turns out children don't render if shouldComponentUpdate() returns false
smashwilson Apr 16, 2018
fc84d2c
Set currentBranchName to 'detached' when detached
smashwilson Apr 16, 2018
78c7739
componentDidUpdate() instead of componentWillReceiveProps()
smashwilson Apr 16, 2018
90f4224
Set both state keys at once
smashwilson Apr 16, 2018
265ef24
fetch, pull, and push return functions now
smashwilson Apr 16, 2018
4f0fe09
:white_check_mark: StatusBarTileController
smashwilson Apr 16, 2018
194aec1
Looks like I didn't regenerate some Relay things?
smashwilson Apr 16, 2018
1ae555f
Move Item properties to the props of the container
smashwilson Apr 16, 2018
7334893
this.refCoAuthorSelect is a RefHolder
smashwilson Apr 16, 2018
40ecfa4
No-op if StatusBar's child renders nothing
smashwilson Apr 16, 2018
2511022
Focus file patch PaneItem
smashwilson Apr 16, 2018
621b783
Update PaneItem tests to reflect the lack of getItem
smashwilson Apr 16, 2018
3f50d97
Title is managed externally now
smashwilson Apr 16, 2018
98896c7
Improved stubbing
smashwilson Apr 16, 2018
433604d
Huh that's probably been broken for a while
smashwilson Apr 16, 2018
9f2be75
Pass a RefHolder to createItem
smashwilson Apr 16, 2018
2fc2b8f
Remaining references to old refs
smashwilson Apr 16, 2018
1a5401d
Band-aid for GitTabController still being wrapped in a decorator
smashwilson Apr 16, 2018
b3b2712
Increasingly messy hack for FilePatchController's refs
smashwilson Apr 16, 2018
f990527
Implement getRealItem() on our items
smashwilson Apr 17, 2018
7634291
Return true from Proxy set
smashwilson Apr 17, 2018
6f1db87
Null activeFilePatch when onDidChangeActivePaneItem fires with undefined
smashwilson Apr 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/controllers/git-tab-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,6 @@ export default class GitTabController extends React.Component {

@autobind
quietlySelectItem(filePath, stagingStatus) {
return this.refs.gitTab.quietlySelectItem(filePath, stagingStatus);
return this.refView.quietlySelectItem(filePath, stagingStatus);
}
}
65 changes: 45 additions & 20 deletions lib/controllers/root-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import url from 'url';
import React from 'react';
import PropTypes from 'prop-types';
import {autobind} from 'core-decorators';
import {CompositeDisposable} from 'event-kit';
import createDOMPurify from 'dompurify';

import StatusBar from '../views/status-bar';
Expand All @@ -23,6 +24,7 @@ import StatusBarTileController from './status-bar-tile-controller';
import RepositoryConflictController from './repository-conflict-controller';
import GithubLoginModel from '../models/github-login-model';
import Conflict from '../models/conflicts/conflict';
import RefHolder from '../models/ref-holder';
import Switchboard from '../switchboard';
import {toNativePathSep, destroyFilePatchPaneItems, destroyEmptyFilePatchPaneItems} from '../helpers';
import {GitError} from '../git-shell-out-strategy';
Expand Down Expand Up @@ -91,19 +93,27 @@ export default class RootController extends React.Component {
credentialDialogQuery: null,
};

this.refGitTabController = new RefHolder();
this.refGitTabWrapperController = new RefHolder();
this.refGitHubTabController = new RefHolder();
this.filePatchRefs = new Map();

this.gitTabTracker = new TabTracker('git', {
uri: 'atom-github://dock-item/git',
getController: () => this.gitTabController,
getController: () => this.refGitTabController.get(),
getWorkspace: () => this.props.workspace,
});

this.githubTabTracker = new TabTracker('github', {
uri: 'atom-github://dock-item/github',
getController: () => this.githubTabController,
getController: () => this.refGithubTabController.get(),
getWorkspace: () => this.props.workspace,
});

this.subscription = this.props.repository.onMergeError(() => this.gitTabTracker.ensureVisible());
this.subscription = new CompositeDisposable(
this.props.repository.onMergeError(() => this.gitTabTracker.ensureVisible()),
this.refGitTabWrapperController.observe(c => this.refGitTabController.setter(c.getWrappedComponentInstance())),
);
}

render() {
Expand Down Expand Up @@ -171,14 +181,13 @@ export default class RootController extends React.Component {
renderPanels() {
const gitTab = this.props.gitTabStubItem && (
<DockItem
ref={c => { this.gitDockItem = c; }}
workspace={this.props.workspace}
onDidCloseItem={this.props.destroyGitTabItem}
stubItem={this.props.gitTabStubItem}
getItem={({subtree}) => subtree.getWrappedComponentInstance()}
itemHolder={this.refGitTabController}
activate={this.props.startOpen}>
<GitTabController
ref={c => { this.gitTabController = c; }}
ref={this.refGitTabWrapperController.setter}
workspace={this.props.workspace}
commandRegistry={this.props.commandRegistry}
notificationManager={this.props.notificationManager}
Expand All @@ -201,12 +210,12 @@ export default class RootController extends React.Component {

const githubTab = this.props.githubTabStubItem && (
<DockItem
ref={c => { this.githubDockItem = c; }}
workspace={this.props.workspace}
onDidCloseItem={this.props.destroyGithubTabItem}
stubItem={this.props.githubTabStubItem}>
stubItem={this.props.githubTabStubItem}
itemHolder={this.refGitHubTabController}>
<GithubTabController
ref={c => { this.githubTabController = c; }}
ref={this.refGitHubTabController.setter}
repository={this.props.repository}
loginModel={this.loginModel}
/>
Expand Down Expand Up @@ -301,14 +310,21 @@ export default class RootController extends React.Component {
return this.props.filePatchItems.map(item => {
const {filePath, stagingStatus, workdir} = getPropsFromUri(item.uri);

let refHolder = this.filePatchRefs.get(item.uri);
if (!refHolder) {
refHolder = new RefHolder();
this.filePatchRefs.set(refHolder);
}

return (
<PaneItem
key={item.key}
workspace={this.props.workspace}
getItem={({subtree}) => subtree}
onDidCloseItem={this.removeFilePatchItem}
stubItem={item}>
stubItem={item}
itemHolder={refHolder}>
<FilePatchController
ref={refHolder.setter}
deserializers={this.props.deserializers}
commandRegistry={this.props.commandRegistry}
tooltips={this.props.tooltips}
Expand Down Expand Up @@ -355,7 +371,18 @@ export default class RootController extends React.Component {

componentDidUpdate() {
this.subscription.dispose();
this.subscription = this.props.repository.onMergeError(() => this.gitTabTracker.ensureVisible());
this.subscription = new CompositeDisposable(
this.props.repository.onMergeError(() => this.gitTabTracker.ensureVisible()),
this.refGitTabWrapperController.observe(c => this.refGitTabController.setter(c.getWrappedComponentInstance())),
);

const existingURIs = new Set(this.props.filePatchItems.map(item => item.uri));
const retainedURIs = [...this.filePatchRefs.keys()];
for (const uri of retainedURIs) {
if (!existingURIs.has(uri)) {
this.filePatchRefs.delete(uri);
}
}
}

onConsumeStatusBar(statusBar) {
Expand Down Expand Up @@ -445,9 +472,9 @@ export default class RootController extends React.Component {

@autobind
surfaceFromFileAtPath(filePath, stagingStatus) {
if (this.gitTabController) {
this.gitTabController.getWrappedComponentInstance().focusAndSelectStagingItem(filePath, stagingStatus);
}
this.refGitTabController.map(c => {
return c.focusAndSelectStagingItem(filePath, stagingStatus);
});
}

@autobind
Expand All @@ -467,11 +494,9 @@ export default class RootController extends React.Component {

@autobind
quietlySelectItem(filePath, stagingStatus) {
if (this.gitTabController) {
return this.gitTabController.getWrappedComponentInstance().quietlySelectItem(filePath, stagingStatus);
} else {
return null;
}
return this.refGitTabController.map(c => {
return c.quietlySelectItem(filePath, stagingStatus);
});
}

async viewChangesForCurrentFile(stagingStatus) {
Expand Down
Loading