Commit e71fc4e
Fix RCTDevSettings init (#57409)
Summary:
#54258 made RCTPackagerConnection a per RCTDevSettings instance and creates it in init. The issue is that init isn't the only way these instances are built, anything constructed through the public initWithDataSource bypasses init entirely, so initWithDataSource never creates _packagerConnection and it stays nil. Those instances silently stop receiving packager commands like reload and devMenu, because the connection they would register handlers on and receive over does not exist.
This moves the creation into initWithDataSource, so every construction path gets a connection. -init still delegates to initWithDataSource:, so the default path is unchanged.
## Changelog:
[IOS] [FIXED] - Create the RCTDevSettings packager connection in initWithDataSource so instances built that way also receive packager commands
Pull Request resolved: #57409
Test Plan:
- [[RCTDevSettings alloc] init].packagerConnection is non-nil (unchanged).
- [[RCTDevSettings alloc] initWithDataSource:dataSource]. packagerConnection is non-nil after this change (it was nil before).
- Verified in a host that subclasses RCTDevSettings via initWithDataSource (Expo Go's scoped dev settings), reload and devMenu from the CLI now reach the app over the packager connection. Before this change they were dropped because the subclass had a nil connection.
Reviewed By: vzaidman, cortinico
Differential Revision: D113387408
Pulled By: cipolleschi
fbshipit-source-id: bdf4b5b431c6870afd652e980022fb43c88bcb0c1 parent 22cfb5c commit e71fc4e
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | 159 | | |
163 | 160 | | |
164 | 161 | | |
| |||
176 | 173 | | |
177 | 174 | | |
178 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| |||
0 commit comments