[HMR] Multiple HMR clients by JohnyDays 路 Pull Request #6179 路 facebook/react-native (original) (raw)
Multiple HMR clients
This pull request adds support for multiple HMR clients 馃巿 馃巶 馃巿 (as per discussed in #5338 and e018aa3)
How it works
Dependency caches are being kept per unique bundle/platform combination in a structure such as
{ ios: { 'path/to/index.ios.bundle': [/* this bundle's dependencies /], }, android: { 'path/to/index.android.bundle': [/ this bundle's dependencies */], }, }
Upon receiving a connection request, it's added to a similar structure per bundle
{ [bundle]: [/connected clients for this bundle/] }
The HMR bundle changes are then forwarded to each device when their bundle's/platform dependencies are invalid/changed.
EDIT: Quick demo 馃槃 https://www.youtube.com/watch?v=etk3Bb7z1eQ
Test Plan
I did some manual tests using 2 emulators and 2 real devices, all connected at the same time, hot reloading successfully! (1 android emulator, 1 android devices, 1 iOS emulator and 1 iOS device).
Is there any way I can automate this? Not familiar with the testing practices for similar features on the project.
@martinbigio You seem like the guy to ask for code review 馃槃 (EDIT: Oh that's an helpful bot)