ITADN

Migrate `rx.moment` to react-moment 2.x (prop restructure + new peer dep)

#7003Openmasenf 创建于 1 天前
enhancement
M
masenfcommented
react-moment 2.0.0 is a breaking major that `reflex-components-moment` cannot take as a straight version bump. The pin is currently held at `react-moment@1.2.2`, and `react-moment` is filtered out of the release branch's outdated-dependency check with a pointer to this issue's problem. ## Why it's blocked The 2.0 release reworks the component's public surface: - global configuration moved into a `settings` prop on the `Moment` component rather than module-level config - the component's props were restructured - the singular `filter` prop was removed - a new peer dependency, `moment-duration-format ^2.2.2`, joins `moment` and `react` `Moment` in `packages/reflex-components-moment/src/reflex_components_moment/moment.py` declares roughly two dozen props one-to-one against the 1.x API (`interval`, `format`, `trim`, `parse`, `add`/`subtract` via `MomentDelta`, `from_now`, `from_now_short`, `from_now_during`, `to_now`, `with_title`, `title_format`, `diff`, `decimal`, `unit`, `duration`, `duration_from_now`, `unix`, `local`, `tz`, `locale`, `on_change`). Each needs checking against the 2.x prop layout, and any that moved or disappeared needs a deprecation path since `rx.moment` is public API. ## What needs doing - [ ] Diff the 1.x → 2.x prop surface against the props declared on `Moment` and write up the mapping (upstream's 2.0.0 migration guide is the reference) - [ ] Deprecate or rename any prop that moved, per the project's deprecation policy (`console.deprecate()` with a `deprecation_version` of the next dot version, `removal_version` of the next major) - [ ] Add `moment-duration-format` to `lib_dependencies` so the new peer dep resolves - [ ] Bump the `react-moment` pin to 2.x and regenerate `.pyi` stubs - [ ] Add an integration test covering the props that changed, and a news fragment under `packages/reflex-components-moment/news/` - [ ] Drop `react-moment` from the frontend ignore list in `.github/workflows/check_outdated_dependencies.yml` ## Notes `moment-timezone` was already bumped to 0.6.3 separately; it is unaffected by this migration. react-moment 2.0.2 was published 2026-05-26, so there is no urgency from a freshness standpoint — this is purely about doing the prop migration properly. Upstream changelog: https://github.com/headzoo/react-moment/blob/master/CHANGELOG.md
1 条评论