-
Notifications
You must be signed in to change notification settings - Fork 25k
[react devtools][device storage] Device storage methods for React DevTools #34667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7da2fe0 to
ecfdeb0
Compare
package.json
Outdated
| "promise": "^8.0.3", | ||
| "react-devtools-core": "4.24.0", | ||
| "react-native-gradle-plugin": "^0.71.0", | ||
| "react-native-mmkv": "^G2.4.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ^G2.4.3 -> ^2.4.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
0997177 to
325b7ed
Compare
… native * Pass `deviceStorageMethods` to React DevTools, which allows DevTools to cache settings on the device that are used during app startup, before DevTools has connected. * These methods write to persistent storage using `react-native-mmkv`.
325b7ed to
150c1b0
Compare
Base commit: 9929ead |
Hm, what happens if the React DevTools connect to a different device than DevTools last used, or a different app on the same device than DevTools last used? |
|
@rbalicki2 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@rickhanlonii after some slight modifications (per a discussion with Luna), it will behave as follows:
So, there isn't an issue with the same DevTools being used with multiple apps, since information never flows from app -> DevTools. OTOH, if you connect an app to multiple DevTools, you will have different settings synced over. As long as the frontend and backend are compatible, though, it should be fine. The frontend will parse the settings defensively, which (when we start syncing more complicated objects like component filters) probably means using a library. But for now, we're just parsing booleans and enums, which is easy enough to do manually. Anyway, going to import this to fbsource. |
|
@rbalicki2 awesome, yeah that makes sense! |
Summary
deviceStorageMethodsparameter to the object passed toconnectToDevTools. These methods provide write and synchronous read access to persistent, on-device storage.Changelog
[General] [Added] - Pass methods that read/write from local storage, using
react-mmkv-storage.Test Plan