Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Update React to 0.14.7 and Immutable to 3.7.6. #12035

Merged
merged 3 commits into from
Feb 14, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
4 changes: 3 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ require.config({
paths: {
"text" : "thirdparty/text/text",
"i18n" : "thirdparty/i18n/i18n",
"react" : "thirdparty/react",

// The file system implementation. Change this value to use different
// implementations (e.g. cloud-based storage).
"fileSystemImpl" : "filesystem/impls/appshell/AppshellFileSystem"
},
map: {
"*": {
"thirdparty/CodeMirror2": "thirdparty/CodeMirror"
"thirdparty/CodeMirror2": "thirdparty/CodeMirror",
"thirdparty/react": "react"
}
}
});
Expand Down
21 changes: 11 additions & 10 deletions src/project/FileTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ define(function (require, exports, module) {
"use strict";

var React = require("thirdparty/react"),
ReactDOM = require("thirdparty/react-dom"),
Classnames = require("thirdparty/classnames"),
Immutable = require("thirdparty/immutable"),
_ = require("thirdparty/lodash"),
Expand Down Expand Up @@ -141,12 +142,12 @@ define(function (require, exports, module) {
* this component, so we keep the model up to date by sending every update via an action.
*/
handleInput: function (e) {
this.props.actions.setRenameValue(this.refs.name.getDOMNode().value.trim());
this.props.actions.setRenameValue(this.refs.name.value.trim());

if (e.keyCode !== KeyEvent.DOM_VK_LEFT &&
e.keyCode !== KeyEvent.DOM_VK_RIGHT) {
// update the width of the input field
var domNode = this.refs.name.getDOMNode(),
var domNode = this.refs.name,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is old code... But do you think we can rename domNode to node to be consistent with the rest of the usage of this.ref.XXX?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

newWidth = _measureText(domNode.value);
$(domNode).width(newWidth);
}
Expand Down Expand Up @@ -181,9 +182,9 @@ define(function (require, exports, module) {
var fullname = this.props.name,
extension = LanguageManager.getCompoundFileExtension(fullname);

var node = this.refs.name.getDOMNode();
var node = this.refs.name;
node.setSelectionRange(0, _getName(fullname, extension).length);
ViewUtils.scrollElementIntoView($("#project-files-container"), $(node), true);
ViewUtils.scrollElementIntoView($("#project-files-container"), $(ReactDOM.findDOMNode(node)), true);
Copy link
Contributor

Choose a reason for hiding this comment

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

New behavior in 0.14 is that this.refs.name is the actual dom node. So ReactDOM.findDOMNode is redundant and no longer needed. Yay :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch: this was a brainfart due to it needing being needed @ L365 on componentDidUpdate because it targets this. Fixed.

},

render: function () {
Expand Down Expand Up @@ -362,7 +363,7 @@ define(function (require, exports, module) {
// start with project-files-container instead of just the interior of
// project-files-container and then the file tree will be one self-contained
// functional unit.
ViewUtils.scrollElementIntoView($("#project-files-container"), $(this.getDOMNode()), true);
ViewUtils.scrollElementIntoView($("#project-files-container"), $(ReactDOM.findDOMNode(this)), true);
} else if (!isSelected && wasSelected && this.state.clickTimer !== null) {
this.clearTimer();
}
Expand Down Expand Up @@ -554,9 +555,9 @@ define(function (require, exports, module) {
componentDidMount: function () {
var fullname = this.props.name;

var node = this.refs.name.getDOMNode();
var node = this.refs.name;
node.setSelectionRange(0, fullname.length);
ViewUtils.scrollElementIntoView($("#project-files-container"), $(node), true);
ViewUtils.scrollElementIntoView($("#project-files-container"), $(ReactDOM.findDOMNode(node)), true);
},

render: function () {
Expand Down Expand Up @@ -810,7 +811,7 @@ define(function (require, exports, module) {
return;
}

var node = this.getDOMNode(),
var node = ReactDOM.findDOMNode(this),
selectedNode = $(node.parentNode).find(this.props.selectedClassName),
selectionViewInfo = this.props.selectionViewInfo;

Expand Down Expand Up @@ -865,7 +866,7 @@ define(function (require, exports, module) {
return;
}

var node = this.getDOMNode(),
var node = ReactDOM.findDOMNode(this),
selectedNode = $(node.parentNode).find(this.props.selectedClassName),
selectionViewInfo = this.props.selectionViewInfo;

Expand Down Expand Up @@ -1012,7 +1013,7 @@ define(function (require, exports, module) {
return;
}

React.render(fileTreeView({
ReactDOM.render(fileTreeView({
treeData: viewModel.treeData,
selectionViewInfo: viewModel.selectionViewInfo,
sortDirectoriesFirst: viewModel.sortDirectoriesFirst,
Expand Down
Loading