|
| 1 | +# ImmutableJS Strategy — Decision Proposal |
| 2 | + |
| 3 | +The Talend UI monorepo uses **ImmutableJS v3** (`^3.8.1`), which has been in maintenance mode since 2017. Two PRs address this technical debt with different strategies. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Option A — Upgrade to ImmutableJS v5 |
| 8 | + |
| 9 | +**PR:** [#5743](https://github.com/Talend/ui/pull/5743) |
| 10 | + |
| 11 | +TUI packages are updated to ImmutableJS v5 (native TypeScript, improved performance). The CMF Redux store keeps its current shape — no store-level breaking change. |
| 12 | + |
| 13 | +**Consumer project impact:** |
| 14 | + |
| 15 | +- Must upgrade their own `immutable` dependency from `^3.x` to `^5.x` |
| 16 | +- Must audit own Immutable code for v3→v5 breaks: `Record` becomes class-based, `Iterable` is removed |
| 17 | +- CMF store access patterns (`.get()`, `.getIn()`) are unchanged |
| 18 | +- A migration guide covers the new TUI package versions, but **provides no guidance for migrating project-level Immutable v3 code to v5** |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## Option B — Remove ImmutableJS entirely |
| 23 | + |
| 24 | +**PR:** [#5755](https://github.com/Talend/ui/pull/5755) |
| 25 | + |
| 26 | +ImmutableJS is completely removed from TUI. All internal data structures become plain JavaScript objects. A new CMF selector API is introduced as a stable access layer. |
| 27 | + |
| 28 | +**Affected TUI packages** (all MAJOR bumps): `react-cmf`, `react-containers`, `react-cmf-cqrs`, `react-sagas`, `react-components`, `react-flow-designer`. |
| 29 | + |
| 30 | +**Consumer project impact:** |
| 31 | + |
| 32 | +- CMF store access (`.get()` / `.getIn()`), container `defaultState`, component state read/write, and test fixtures must be migrated — covered by [per-package migration guides](../../docs/migration-guides/migration-guide-remove-immutable.md) |
| 33 | +- **Only TUI-related Immutable usage is affected.** Project-internal code that uses ImmutableJS independently of TUI is untouched |
| 34 | +- After migration, each project is free to keep, upgrade, or remove Immutable at its own pace |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +## Comparison |
| 39 | + |
| 40 | +| Criterion | Option A | Option B | |
| 41 | +| ------------------------------------- | -------------------------------- | ----------------------- | |
| 42 | +| TUI breaking changes | Limited | 6 MAJOR version bumps | |
| 43 | +| Consumer: own `immutable` dep | Must upgrade to `^5.x` | Unaffected | |
| 44 | +| Consumer: store / state access | Unchanged | Must migrate (guided) | |
| 45 | +| Consumer: project-internal Immutable | Must audit and update (unguided) | Not affected | |
| 46 | +| Long-term TUI dependency on Immutable | Yes (v5) | Eliminated | |
| 47 | +| Migration guide coverage | TUI packages only | Full per-package guides | |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Recommendation |
| 52 | + |
| 53 | +**Option B** is recommended: |
| 54 | + |
| 55 | +- Option A defers the problem — projects still need to migrate their own Immutable v3 code without any guide, and TUI would remain tied to ImmutableJS long-term |
| 56 | +- Option B is a finite, documented migration: effort is higher but bounded, and projects gain full independence from ImmutableJS after migration |
| 57 | + |
| 58 | +> The main argument for Option A: if projects have very heavy own Immutable usage, they would need a v3→v5 upgrade regardless — Option A allows doing it in one pass. |
| 59 | +
|
| 60 | +--- |
0 commit comments