[react devtools] Device storage support#25213
[react devtools] Device storage support#25213rbalicki2 wants to merge 1 commit intofacebook:mainfrom rbalicki2:rb/device-storage
Conversation
|
It looks like in your diff, you are putting most of the device storage logic inside the shared devtools folder ( Looking at your PRs, it seems like the core of the device storage logic lives in React Native, and you are just calling into it from DevTools. I wonder if it would simplify your PR if you moved let RN and DevTools communicate via a bridge instead of passing around functions. Ex:
Also open to other ideas! |
|
Yeah, I can move this logic to to
Optimistically, this means we can make no changes to RN. However, maybe including an external library in React DevTools that requires Closing for now, until I make these changes |
|
Welp, unless we make |
Summary
__REACT_DEVTOOLS_GLOBAL_HOOK__,injectDeviceStorageMethods, which (in this diff) takes{ setValueOnDevice }.setValueOnDevicegives devtools the ability to update values in device storage. In a future diff,injectDeviceStorageMethodswill take an object with multiple properties.runApplication, will setwindow.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__(etc) from the values in device storage, and then callinjectDeviceStorageMethods.injectDeviceStorageMethodswill:patchConsoleAlso
patchConsolewith values from window in multiple places, centralize that in one fileBigger picture
Three things stand out as obvious follow ups:
__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__from a given key in storage. It would be better if all of that logic could exist on the react devtools side. This can be achieved by injecting{ setValueOnDevice, getValueOnDevice }Notes
How did you test this change?