Removed createContainer
This commit is contained in:
parent
86a94e37e4
commit
311b4ee1f3
8 changed files with 34 additions and 32 deletions
|
|
@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
|
|||
import { Table, Alert, Button } from 'react-bootstrap';
|
||||
import { timeago, monthDayYearAtTime } from '@cleverbeagle/dates';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
import DocumentsCollection from '../../../api/Documents/Documents';
|
||||
import Loading from '../../components/Loading/Loading';
|
||||
|
|
@ -73,10 +73,10 @@ Documents.propTypes = {
|
|||
history: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default createContainer(() => {
|
||||
export default withTracker(() => {
|
||||
const subscription = Meteor.subscribe('documents');
|
||||
return {
|
||||
loading: !subscription.ready(),
|
||||
documents: DocumentsCollection.find().fetch(),
|
||||
};
|
||||
}, Documents);
|
||||
})(Documents);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import Documents from '../../../api/Documents/Documents';
|
||||
import DocumentEditor from '../../components/DocumentEditor/DocumentEditor';
|
||||
|
|
@ -14,20 +14,20 @@ const EditDocument = ({ doc, history }) => (doc ? (
|
|||
) : <NotFound />);
|
||||
|
||||
EditDocument.defaultProps = {
|
||||
doc: null,
|
||||
doc: null
|
||||
};
|
||||
|
||||
EditDocument.propTypes = {
|
||||
doc: PropTypes.object,
|
||||
history: PropTypes.object.isRequired,
|
||||
history: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default createContainer(({ match }) => {
|
||||
export default withTracker(({ match }) => {
|
||||
const documentId = match.params._id;
|
||||
const subscription = Meteor.subscribe('documents.view', documentId);
|
||||
|
||||
return {
|
||||
loading: !subscription.ready(),
|
||||
doc: Documents.findOne(documentId),
|
||||
doc: Documents.findOne(documentId)
|
||||
};
|
||||
}, EditDocument);
|
||||
})(EditDocument);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import Subscriptions from '../../../api/Subscriptions/Subscriptions';
|
||||
import SubscriptionEditor from '../../components/SubscriptionEditor/SubscriptionEditor';
|
||||
|
|
@ -22,7 +22,7 @@ EditSubscription.propTypes = {
|
|||
history: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default createContainer(({ match }) => {
|
||||
export default withTracker(({ match }) => {
|
||||
const subscriptionId = match.params._id;
|
||||
const subscription = Meteor.subscribe('subscriptions.view', subscriptionId);
|
||||
|
||||
|
|
@ -30,4 +30,4 @@ export default createContainer(({ match }) => {
|
|||
loading: !subscription.ready(),
|
||||
doc: Subscriptions.findOne(new Meteor.Collection.ObjectID(subscriptionId))
|
||||
};
|
||||
}, EditSubscription);
|
||||
})(EditSubscription);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import i18n from '/imports/startup/client/i18n';
|
||||
import PageHeader from '../../components/PageHeader/PageHeader';
|
||||
|
|
@ -33,7 +33,7 @@ Page.propTypes = {
|
|||
|
||||
const pageContent = new ReactiveVar('');
|
||||
|
||||
export default createContainer(({ content, page }) => {
|
||||
export default withTracker(({ content, page }) => {
|
||||
window.scrollTo(0, 0); // Force window to top of page.
|
||||
|
||||
Meteor.call('utility.getPage', page, i18n.language, (error, response) => {
|
||||
|
|
@ -47,4 +47,4 @@ export default createContainer(({ content, page }) => {
|
|||
return {
|
||||
content: content || pageContent.get()
|
||||
};
|
||||
}, Page);
|
||||
})(Page);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { Accounts } from 'meteor/accounts-base';
|
|||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
import { testId } from '/imports/ui/components/Utils/TestUtils';
|
||||
import Col from '../../components/Col/Col';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import InputHint from '../../components/InputHint/InputHint';
|
||||
import validate from '../../../modules/validate';
|
||||
import { translate } from 'react-i18next';
|
||||
|
|
@ -267,11 +267,11 @@ Profile.propTypes = {
|
|||
i18n: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default translate([], { wait: true })(createContainer(() => {
|
||||
export default translate([], { wait: true })(withTracker(() => {
|
||||
const subscription = Meteor.subscribe('users.editProfile');
|
||||
|
||||
return {
|
||||
loading: !subscription.ready(),
|
||||
user: Meteor.user()
|
||||
};
|
||||
}, Profile));
|
||||
})(Profile));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ButtonToolbar, ButtonGroup, Button } from 'react-bootstrap';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
import Documents from '../../../api/Documents/Documents';
|
||||
|
|
@ -38,7 +38,9 @@ const renderDocument = (doc, match, history) => (doc ? (
|
|||
</div>
|
||||
) : <NotFound />);
|
||||
|
||||
const ViewDocument = ({ loading, doc, match, history }) => (
|
||||
const ViewDocument = ({
|
||||
loading, doc, match, history
|
||||
}) => (
|
||||
!loading ? renderDocument(doc, match, history) : <Loading />
|
||||
);
|
||||
|
||||
|
|
@ -46,15 +48,15 @@ ViewDocument.propTypes = {
|
|||
loading: PropTypes.bool.isRequired,
|
||||
doc: PropTypes.object,
|
||||
match: PropTypes.object.isRequired,
|
||||
history: PropTypes.object.isRequired,
|
||||
history: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default createContainer(({ match }) => {
|
||||
export default withTracker(({ match }) => {
|
||||
const documentId = match.params._id;
|
||||
const subscription = Meteor.subscribe('documents.view', documentId);
|
||||
|
||||
return {
|
||||
loading: !subscription.ready(),
|
||||
doc: Documents.findOne(documentId),
|
||||
doc: Documents.findOne(documentId)
|
||||
};
|
||||
}, ViewDocument);
|
||||
})(ViewDocument);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ButtonToolbar, ButtonGroup, Button } from 'react-bootstrap';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
import Subscriptions from '../../../api/Subscriptions/Subscriptions';
|
||||
|
|
@ -54,7 +54,7 @@ ViewSubscription.propTypes = {
|
|||
history: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default createContainer(({ match }) => {
|
||||
export default withTracker(({ match }) => {
|
||||
const subscriptionId = match.params._id;
|
||||
const subscription = Meteor.subscribe('subscriptions.view', subscriptionId);
|
||||
|
||||
|
|
@ -62,4 +62,4 @@ export default createContainer(({ match }) => {
|
|||
loading: !subscription.ready(),
|
||||
doc: Subscriptions.findOne(new Meteor.Collection.ObjectID(subscriptionId))
|
||||
};
|
||||
}, ViewSubscription);
|
||||
})(ViewSubscription);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue