From a1a1b9a8017ddb543c076e1f2d37a01ba4ace4c9 Mon Sep 17 00:00:00 2001 From: vjrj Date: Tue, 21 Jul 2026 12:44:46 +0200 Subject: [PATCH] deps: react-bootstrap 0.31 -> 2 (Bootstrap 5 CSS deferred as debt) Removes the largest batch of React-19-blocking warnings: the 0.31 components (Grid, FormGroup, ControlLabel, Navbar.Header/Brand, Checkbox, SafeAnchor) all leaned on legacy context / defaultProps. 29 files converted: Grid->Container, FormGroup/ControlLabel/FormControl/ HelpBlock -> Form.Group/Label/Control/Text, Checkbox -> Form.Check (label as prop), bsStyle->variant (default->secondary), bsSize->size, pull-right->float-end. Custom Col.js now re-exports v2's Col; custom NavItem.js rewritten self-contained (no SafeAnchor/createChainedFunction); Navigation.js drops react-bootstrap Navbar (raw markup anyway). CSS stays on Bootstrap 4 (alexwine:bootstrap-4) for now: the BS4->5 jump is entangled with the jQuery carousel/swipe + navbar-collapse and is tracked as separate debt in UPGRADE.md. Only .form-label needed a shim (forms.scss). Browser-verified home carousel+navbar, signup form + terms checkbox, login form; REST smoke byte-identical. --- UPGRADE.md | 2 + .../CenterInMyPosition/CenterInMyPosition.js | 2 +- imports/ui/components/Col/Col.js | 117 +---- .../DocumentEditor/DocumentEditor.js | 16 +- imports/ui/components/Feedback/Feedback.js | 14 +- imports/ui/components/Footer/Footer.js | 8 +- .../LocationAutocomplete.js | 10 +- imports/ui/components/NavItem/NavItem.js | 65 ++- .../ui/components/Navigation/Navigation.js | 20 +- imports/ui/components/Prompt/Prompt.js | 2 +- .../ui/components/ReSendEmail/ReSendEmail.js | 4 +- .../components/SelectionMap/SelectionMap.js | 4 +- imports/ui/layouts/App/App.js | 6 +- imports/ui/pages/Documents/Documents.js | 8 +- imports/ui/pages/Fires/Fires.js | 8 +- imports/ui/pages/FiresMap/FiresMap.js | 22 +- imports/ui/pages/Login/Login.js | 20 +- imports/ui/pages/NotFound/NotFound.js | 2 +- imports/ui/pages/Profile/Profile.js | 40 +- .../pages/RecoverPassword/RecoverPassword.js | 12 +- .../ui/pages/ResetPassword/ResetPassword.js | 18 +- imports/ui/pages/Signup/Signup.js | 39 +- .../ui/pages/Subscriptions/Subscriptions.js | 6 +- .../pages/Subscriptions/SubscriptionsMap.js | 2 +- imports/ui/pages/VerifyEmail/VerifyEmail.js | 2 +- imports/ui/pages/ViewDocument/ViewDocument.js | 4 +- .../ViewSubscription/ViewSubscription.js | 4 +- imports/ui/stylesheets/forms.scss | 12 +- package-lock.json | 401 +++++++++++++++--- package.json | 2 +- 30 files changed, 539 insertions(+), 333 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index cbd1a83..56ffefc 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -317,6 +317,8 @@ MONGO_CONTAINER=tcef-mongo7 MONGO_SHELL=mongosh MONGO_PORT=27019 ./smoke/smoke.s | fourseven:scss | 4.5.4 | 4.14.1 | ✅ node-12 compatible | | node-gcm | 1.0.2 | — | ✅ removed (dead API, moved to microservice) | | react-helmet | 5.2.0 | react-helmet-async 2.0.5 | ✅ done — react-helmet is unmaintained and misbehaves under React 18 StrictMode. Drop-in: same `` children API across the 15 pages; `` wraps `` in `imports/startup/client/index.js`. Verified in browser: per-page titles, meta description and hreflang alternates injected (`data-rh`). Note: head updates are rAF-deferred (like react-helmet), so hidden/background tabs don't flush — irrelevant for real users. | +| react-bootstrap | 0.31.5 | 2.10 | ✅ done — kills the biggest batch of React-19-blocking warnings (Grid/FormGroup/ControlLabel/Navbar.Header/Navbar.Brand/Checkbox/SafeAnchor all used legacy context/defaultProps). 29 files: `Grid`→`Container`, `FormGroup/ControlLabel/FormControl/HelpBlock`→`Form.Group/Label/Control/Text`, `Checkbox`→`Form.Check` (label moves to a prop), `bsStyle`→`variant` (×23, `"default"`→`"secondary"`), `bsSize`→`size` (×2), `pull-right`→`float-end` (×7). Custom `Col.js` (used v0.31 `bootstrapUtils`/`StyleConfig` internals) now re-exports v2's `Col`; custom `NavItem.js` rewritten self-contained (dropped `SafeAnchor`+`createChainedFunction`); `Navigation.js` drops the react-bootstrap `Navbar` (was hand-rolled raw markup anyway). **CSS kept at Bootstrap 4** (see next row) — the only BS5-only class v2 emits that BS4 lacks is `.form-label`, shimmed in `forms.scss`. Browser-verified: home carousel+navbar, signup form + terms `Form.Check` (toggles submit), login form; REST smoke byte-identical. | +| Bootstrap CSS/JS | 4.1 (alexwine:bootstrap-4) | 5.x | ⏸️ **deferred as debt.** The app's CSS+JS still comes from the Atmosphere `alexwine:bootstrap-4` (Bootstrap 4 + jQuery). The BS4→5 jump is a separate invasive sub-project: the home **carousel** uses the jQuery `bootstrap-carousel-swipe` plugin (BS4-only), the **navbar collapse** and ~17 `data-toggle`/`data-slide` attributes across 6 files are BS4 jQuery behaviors, and BS5 is vanilla-JS with `data-bs-*`. react-bootstrap v2 runs fine on BS4 CSS for every component we use (Button/Alert/Row/Col/Table/ButtonGroup/Modal render identical classes; only `.form-label` needed a shim). Do this jump on its own: npm `bootstrap@5` SCSS+JS, rewrite carousel (BS5 has native swipe → drop the plugin), `data-toggle`→`data-bs-toggle`, `ml-auto`→`ms-auto`, etc. | | reactstrap | 5.0.0-alpha.3 | — | ✅ removed — zero imports in the codebase (react-bootstrap covers all UI). | | react-leaflet-sidebarv2 | 0.5.1 | — | ✅ removed — never imported. | | react-router-hash-link | 1.1.1 | — | ✅ removed — only a commented-out import in Index.js. | diff --git a/imports/ui/components/CenterInMyPosition/CenterInMyPosition.js b/imports/ui/components/CenterInMyPosition/CenterInMyPosition.js index 02537df..574da35 100644 --- a/imports/ui/components/CenterInMyPosition/CenterInMyPosition.js +++ b/imports/ui/components/CenterInMyPosition/CenterInMyPosition.js @@ -48,7 +48,7 @@ class CenterInMyPosition extends React.Component { const { onlyIcon, t } = this.props; const msg = t('Centrar en tu ubicación'); return ( - ); } diff --git a/imports/ui/components/Col/Col.js b/imports/ui/components/Col/Col.js index 2a20586..affc10d 100644 --- a/imports/ui/components/Col/Col.js +++ b/imports/ui/components/Col/Col.js @@ -1,111 +1,6 @@ -import classNames from 'classnames'; -import React from 'react'; -import PropTypes from 'prop-types'; -import elementType from 'prop-types-extra/lib/elementType'; - -import { bsClass, prefix, splitBsProps } from 'react-bootstrap/lib/utils/bootstrapUtils'; -import { DEVICE_SIZES } from 'react-bootstrap/lib/utils/StyleConfig'; - -const column = PropTypes.oneOfType([ - PropTypes.oneOf(['auto']), - PropTypes.number, -]); - -const propTypes = { - componentClass: elementType, - - /** - * The number of columns you wish to span - * - * for Extra small devices Phones (<576px) - * - * class-prefix `col-` - */ - xs: column, - - /** - * The number of columns you wish to span - * - * for Small devices Tablets (≥576px) - * - * class-prefix `col-sm-` - */ - sm: column, - - /** - * The number of columns you wish to span - * - * for Medium devices Desktops (≥768px) - * - * class-prefix `col-md-` - */ - md: column, - - /** - * The number of columns you wish to span - * - * for Large devices Desktops (≥992px) - * - * class-prefix `col-lg-` - */ - lg: column, - - /** - * The number of columns you wish to span - * - * for Large devices Desktops (≥1200px) - * - * class-prefix `col-xl-` - */ - xl: column, -}; - -const defaultProps = { - componentClass: 'div', -}; - -class Col extends React.Component { - render() { - const { componentClass: Component, className, ...props } = this.props; - const [bsProps, elementProps] = splitBsProps(props); - - const classes = []; - - DEVICE_SIZES.forEach((size) => { - const propValue = elementProps[size]; - - if (propValue == null) return; - - if (size === 'xs') { - // col and col-4 - classes.push(propValue === true ? - bsProps.bsClass : - prefix(bsProps, `${propValue}`), - ); - } else { - // col-md-3 - classes.push( - prefix(bsProps, `${size}-${propValue}`), - ); - } - - delete elementProps[size]; - }); - - if (!classes.length) { - classes.push(bsProps.bsClass); // plain 'col' - } - - return ( - - ); - } -} - -Col.propTypes = propTypes; -Col.defaultProps = defaultProps; - -export default bsClass('col', Col); +// The old custom Col hand-rolled Bootstrap-4/5 grid classes on top of +// react-bootstrap 0.31 internals (`bootstrapUtils`, `StyleConfig`), which no +// longer exist in react-bootstrap v2. v2's own Col produces the exact same +// `col`/`col-{size}-{n}` output for the xs/sm/md/lg/xl props we use, so we +// simply re-export it and keep every importer unchanged. +export { Col as default } from 'react-bootstrap'; diff --git a/imports/ui/components/DocumentEditor/DocumentEditor.js b/imports/ui/components/DocumentEditor/DocumentEditor.js index 4a42df7..d3ea3ab 100644 --- a/imports/ui/components/DocumentEditor/DocumentEditor.js +++ b/imports/ui/components/DocumentEditor/DocumentEditor.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { FormGroup, ControlLabel, Button } from 'react-bootstrap'; +import { Form, Button } from 'react-bootstrap'; import { Meteor } from 'meteor/meteor'; import { Bert } from 'meteor/themeteorchef:bert'; import validate from '../../../modules/validate'; @@ -57,8 +57,8 @@ class DocumentEditor extends React.Component { render() { const { doc } = this.props; return (
(this.form = form)} onSubmit={event => event.preventDefault()}> - - Title + + Title - - - Body + + + Body