cleanup: defaultProps -> JS default params on our function components

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.
This commit is contained in:
vjrj 2026-07-21 13:54:02 +02:00
parent 5661e129fb
commit 4ddaa0d8ec
9 changed files with 17 additions and 51 deletions

View file

@ -38,7 +38,12 @@ const serviceLabel = {
google: <span><Icon icon="google" /> <Trans parent="span">Iniciar sesión con Google</Trans></span>,
};
const OAuthLoginButton = ({ service, callback }) => (
const defaultCallback = (error) => {
if (error) Bert.alert(T9n.get(`error.accounts.${error.message}`), 'danger');
// Bert.alert(error.message, 'danger');
};
const OAuthLoginButton = ({ service, callback = defaultCallback }) => (
<button
className={`btn btn-block btn-raised btn-danger OAuthLoginButton OAuthLoginButton-${service}`}
type="button"
@ -48,13 +53,6 @@ const OAuthLoginButton = ({ service, callback }) => (
</button>
);
OAuthLoginButton.defaultProps = {
callback: (error) => {
if (error) Bert.alert(T9n.get(`error.accounts.${error.message}`), 'danger');
// Bert.alert(error.message, 'danger');
},
};
OAuthLoginButton.propTypes = {
service: PropTypes.string.isRequired,
callback: PropTypes.func,