Skip to content

Conversation

25harsh
Copy link

@25harsh 25harsh commented Sep 15, 2025

Summary

The view method was calling reactNativeFactory?.rootViewFactory.view(...) instead of using the already defined lazy property rootViewFactory, making the lazy property redundant.

Modified view method in ReactNativeBrownfield.swift to use rootViewFactory?.view(...) instead of reactNativeFactory?.rootViewFactory.view(...)

Test plan

Code builds successfully
Existing tests should continue to pass as the behavior is unchanged
No breaking changes introduced - the method signature and functionality remain identical

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

launchOptions: [AnyHashable: Any]? = nil
) -> UIView? {
reactNativeFactory?.rootViewFactory.view(
rootViewFactory?.view(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Lazy Initialization Timing Bug

The change to use a lazy rootViewFactory property introduces a timing issue. If view() is called before startReactNative(), rootViewFactory gets initialized to nil (as reactNativeFactory is not yet available). Since it's lazy, this nil value is permanently cached, preventing view() from ever returning a valid view, even after reactNativeFactory is later initialized.

Fix in Cursor Fix in Web

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats true, but either way the app will crash if startReactNative isn't called because ReactNativeViewController().view will be nil in that case

@okwasniewski what do you think is it a good idea to have a fallback UIView or the crash is indicative of integration error

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