Skip to content

Fix React surface observer lifecycle - #8354

Open
OskarEichler wants to merge 1 commit into
wix:masterfrom
OskarEichler:codex/fix-react-view-surface-observers
Open

Fix React surface observer lifecycle#8354
OskarEichler wants to merge 1 commit into
wix:masterfrom
OskarEichler:codex/fix-react-view-surface-observers

Conversation

@OskarEichler

@OskarEichler OskarEichler commented Aug 31, 2026

Copy link
Copy Markdown

Fix

New-Architecture RNNReactButtonView instances created through RCTHost register twice with the same RCTSurfacePresenter: once in RNNReactView and again in the subclass. Every button therefore receives duplicate presenter callbacks. Bridge-created New-Architecture views take the opposite path and never register, so their pending appearance lifecycle cannot be released by mount callbacks. The base view also never unregisters, leaving a stale weak entry in the presenter's observer vector after teardown.

Register exactly once in both base initializers after successful superclass initialization, retain the presenter weakly, remove the observer during deallocation, and delete the subclass registration. This also avoids registering an incompletely initialized self before [super initWithSurface:] returns.

Verification

  • Added a New-Architecture host-path regression using a non-retaining presenter spy; exact baseline records two registrations and the fix records one.
  • Reviewed the bridge path against _isMounted's only assignment sites and added the same base observer lifecycle there; compilation covers both New-Architecture initializers.
  • New-Architecture iOS build-for-testing succeeds.
  • Focused RNNReactButtonViewTest passes 1/1 on an iOS 26.5 simulator.
  • Full simulator suite before the final test-only refinement: 356/357 pass; the only failure is the unchanged environment-sensitive RNNRootViewControllerTest.testTopBarNoBorderOff, also failing on baseline.
  • Targeted clang-format and git diff --check pass.

Breaking changes

None. This removes duplicate callbacks and cleans up observer lifecycle without changing the public API.

@OskarEichler
OskarEichler force-pushed the codex/fix-react-view-surface-observers branch from b3cb66e to 6c9d627 Compare August 31, 2026 09:35
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