react-native-onyx 1.0.126 → 1.0.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/web.development.js +228 -108
- package/dist/web.development.js.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/lib/DevTools.js +71 -0
- package/lib/Onyx.d.ts +1 -0
- package/lib/Onyx.js +32 -4
- package/lib/utils.d.ts +8 -1
- package/lib/utils.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -390,6 +390,44 @@ Sample output of `Onyx.printMetrics()`
|
|
|
390
390
|
|
|
391
391
|
It can be useful to log why Onyx is calling `setState()` on a particular React component so that we can understand which key changed, what changed about the value, and the connected component that ultimately rendered as a result. When used correctly this can help isolate problem areas and unnecessary renders in the code. To enable this feature, pass `debugSetState: true` to the config and grep JS console logs for `[Onyx-Debug]`.
|
|
392
392
|
|
|
393
|
+
# Redux DevTools Extension
|
|
394
|
+
|
|
395
|
+
If you want to debug updates made to the local storage on the web app, you can use Redux DevTools Extension, which provides an easy to use GUI.
|
|
396
|
+
This extension provides the following features:
|
|
397
|
+
|
|
398
|
+
- Each update (merge/set/clear/etc) made to the local storage is logged with the data that was written or erased.
|
|
399
|
+
- Check the state of the local storage at a certain point in time and compare it with it's previous state.
|
|
400
|
+
|
|
401
|
+
Currently this tool is only available on Web.
|
|
402
|
+
|
|
403
|
+
### Installing the extension
|
|
404
|
+
|
|
405
|
+
To use the extension, simply install it from your favorite web browser store:
|
|
406
|
+
|
|
407
|
+
- [Google Chrome](https://chromewebstore.google.com/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?pli=1)
|
|
408
|
+
- [Microsoft Edge](https://microsoftedge.microsoft.com/addons/detail/redux-devtools/nnkgneoiohoecpdiaponcejilbhhikei)
|
|
409
|
+
- [Mozilla Firefox](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/)
|
|
410
|
+
|
|
411
|
+
After installing the extension, Onyx will automatically connect to it and start logging any updates made to the local storage.
|
|
412
|
+
|
|
413
|
+
### Usage
|
|
414
|
+
|
|
415
|
+
The extension interface is pretty simple, on the left sidebar you can see all the updates made to the local storage, in ascending order, and on the right pane you can see the whole the current state, payload of an action and the diff between the previous state and the current state after the action was triggered.
|
|
416
|
+
|
|
417
|
+
The action logs use this naming convention:
|
|
418
|
+
|
|
419
|
+
`@@INIT` - Initial action which is triggered when Onyx connects to the extension. It's payload consists of the initial state.
|
|
420
|
+
|
|
421
|
+
`merge/<KEY>` - Merge action which is triggered when `Onyx.merge()` is called.
|
|
422
|
+
|
|
423
|
+
`mergecollection/<KEY>` - Merge action which is triggered when `Onyx.mergeCollection()` is called.
|
|
424
|
+
|
|
425
|
+
`set/<KEY>` - Set action which is triggered when `Onyx.set()` is called.
|
|
426
|
+
|
|
427
|
+
`multiset/<KEY>` - Set action which is triggered when `Onyx.multiSet()` is called.
|
|
428
|
+
|
|
429
|
+
`CLEAR` - Clear action which is triggered when `Onyx.clear()` is called.
|
|
430
|
+
|
|
393
431
|
# Development
|
|
394
432
|
|
|
395
433
|
`react-native` bundles source using the `metro` bundler. `metro` does not follow symlinks, so we can't use `npm link` to
|