Skip to content

fix: Rename CachedProp to ReactProp, re-add legacy CachedProp as deprecated - #1517

Merged
mrousavy merged 1 commit into
mainfrom
claude/cachedprop-rename-deprecate-a1bbe7
Aug 20, 2026
Merged

fix: Rename CachedProp to ReactProp, re-add legacy CachedProp as deprecated#1517
mrousavy merged 1 commit into
mainfrom
claude/cachedprop-rename-deprecate-a1bbe7

Conversation

@mrousavy

Copy link
Copy Markdown
Member

Why

The v0.37.0 View props rewrite changed CachedProp<T>'s API (immutable shared entry with get()/isProvided()/hasSameValue()), which broke every module whose specs were generated by nitrogen <= 0.36.x: their generated code uses the old mutable API (.value, .isDirty, 3-arg fromRawValue(runtime, value, oldProp)) and no longer compiled against the new core. See the VisionCamera CI failure, where the published react-native-nitro-image failed with no member named 'isDirty' in 'margelo::nitro::CachedProp<...>'.

What

  • Renamed the new implementation to ReactProp<T> (cpp/views/ReactProp.hpp). Since the legacy 3-arg fromRawValue overload no longer needs to live here, its single-use private helpers (fromJSIValue, convertAndCacheJSIValue) are folded into the one public fromRawValue.
  • Re-added CachedProp<T> exactly as it shipped in v0.36.5 (mutable value/isDirty, equals, 3-arg fromRawValue), with [[deprecated]] on the struct, so specs generated by nitrogen <= 0.36.x compile again - with a deprecation warning nudging authors to re-generate.
  • Updated nitrogen's CppHybridViewComponent.ts to emit ReactProp, re-generated the nitro-test specs (pure rename), and added ReactProp.hpp to the podspec's public headers (Android's prepareHeaders globs all .hpp automatically).

Verification

  • The published react-native-nitro-image@0.15.1 generated C++ (the exact code from the VisionCamera failure) compiles against the new headers with 0 errors, only CachedProp is deprecated warnings.
  • The legacy Android StateUpdater pattern (.isDirty/.value read+write, copy ctor, lambda-in-member-init) compiles in a faithful reproduction TU.
  • Re-generated HybridTestViewComponent.cpp / HybridRecyclableTestViewComponent.cpp compile cleanly against real RN headers, as does a coexistence TU including both CachedProp.hpp and ReactProp.hpp (old + new modules in one app).

Note for 0.37.0-beta.1 release notes

Modules that already re-generated specs with nitrogen@0.37.0-beta.0 (which emitted the new API under the CachedProp name) will get hard compile errors against this change and must re-run nitrogen. This is unavoidable intra-beta breakage - the CachedProp name can only bind to one API, and it now belongs to the <= 0.36.x meaning that published modules depend on.

🤖 Generated with Claude Code

…s deprecated

The v0.37.0 View props rewrite changed `CachedProp<T>`'s API (immutable
shared entry, `get()`/`isProvided()`/`hasSameValue()`), which broke
modules whose specs were generated by nitrogen <= 0.36.x - their generated
code uses the old mutable API (`.value`, `.isDirty`, 3-arg
`fromRawValue(runtime, value, oldProp)`) and no longer compiled against
the new core.

- Rename the new implementation to `ReactProp<T>` (cpp/views/ReactProp.hpp),
  and fold its now-single-use private helpers into `fromRawValue`
- Re-add `CachedProp<T>` exactly as it shipped in v0.36.5, marked
  [[deprecated]], so old generated specs compile again (with a warning)
- Update nitrogen to emit `ReactProp` and re-generate nitro-test specs
@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
nitro-docs Skipped Skipped Aug 20, 2026 4:26pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant