Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/713#discussion_r65165501
--- Diff: app/addons/documents/changes/components.react.jsx ---
@@ -21,168 +21,174 @@ import ReactComponents from
"../../components/react-components.react";
import ReactCSSTransitionGroup from "react-addons-css-transition-group";
import "../../../../assets/js/plugins/prettify";
-var changesStore = Stores.changesStore;
-
+var store = Stores.changesStore;
var BadgeList = ReactComponents.BadgeList;
-// the top-level component for the Changes Filter section. Handles
hiding/showing of the filters form
-var ChangesHeaderController = React.createClass({
- getInitialState: function () {
- return this.getStoreState();
- },
- getStoreState: function () {
+class ChangesController extends React.Component {
+ constructor (props) {
+ super(props);
+ this.state = this.getStoreState();
+ }
+
+ getStoreState () {
return {
- showTabContent: changesStore.isTabVisible()
+ changes: store.getChanges(),
+ loaded: store.isLoaded(),
+ databaseName: store.getDatabaseName(),
+ isShowingSubset: store.isShowingSubset()
};
- },
+ }
- onChange: function () {
+ onChange () {
this.setState(this.getStoreState());
- },
-
- componentDidMount: function () {
- changesStore.on('change', this.onChange, this);
- },
+ }
- componentWillUnmount: function () {
- changesStore.off('change', this.onChange);
- },
+ componentDidMount () {
+ store.on('change', this.onChange, this);
--- End diff --
Actually not in this instance. React doesn't handle all the binding for us,
so we need to explicitly bind it so that onChange can reference
this.getStoreState().
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---