React 19 drops defaultProps on function components. Converted the 9 of
ours that used it (App, Navigation, ReSendEmail, Reconnect, OAuthLoginButton,
PageHeader, Page, EditDocument, EditSubscription) to destructured default
params; App defaults userId/emailAddress in its withTracker instead (it
spreads {...props} widely). Class components keep defaultProps (still
supported). The only defaultProps warnings left are from the react-share
npm package (CreatedButton/Icon), not our code. REST smoke byte-identical.
29 lines
1 KiB
JavaScript
29 lines
1 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
import { Meteor } from 'meteor/meteor';
|
|
import Subscriptions from '../../../api/Subscriptions/Subscriptions';
|
|
import SubscriptionEditor from '../../components/SubscriptionEditor/SubscriptionEditor';
|
|
import NotFound from '../NotFound/NotFound';
|
|
|
|
const EditSubscription = ({ doc = null, history }) => (doc ? (
|
|
<div className="EditSubscription">
|
|
<h4 className="page-header">{`Editing "${doc.title}"`}</h4>
|
|
<SubscriptionEditor doc={doc} history={history} />
|
|
</div>
|
|
) : <NotFound />);
|
|
|
|
EditSubscription.propTypes = {
|
|
doc: PropTypes.object,
|
|
history: PropTypes.object.isRequired
|
|
};
|
|
|
|
export default withTracker(({ match }) => {
|
|
const subscriptionId = match.params._id;
|
|
const subscription = Meteor.subscribe('subscriptions.view', subscriptionId);
|
|
|
|
return {
|
|
loading: !subscription.ready(),
|
|
doc: Subscriptions.findOne(new Meteor.Collection.ObjectID(subscriptionId))
|
|
};
|
|
})(EditSubscription);
|