You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-12Lines changed: 2 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -196,16 +196,7 @@ export default withOnyx({
196
196
})(App);
197
197
```
198
198
199
-
Differently from `useOnyx()`, `withOnyx()` will delay the rendering of the wrapped component until all keys/entities have been fetched and passed to the component, this can be convenient for simple cases. This however, can really delay your application if many entities are connected to the same component, you can pass an `initialValue` to each key to allow Onyx to eagerly render your component with this value.
200
-
201
-
```javascript
202
-
exportdefaultwithOnyx({
203
-
session: {
204
-
key:ONYXKEYS.SESSION,
205
-
initialValue: {}
206
-
},
207
-
})(App);
208
-
```
199
+
Differently from `useOnyx()`, `withOnyx()` will delay the rendering of the wrapped component until all keys/entities have been fetched and passed to the component, this can be convenient for simple cases. This however, can really delay your application if many entities are connected to the same component.
209
200
210
201
Additionally, if your component has many keys/entities when your component will mount but will receive many updates as data is fetched from DB and passed down to it, as every key that gets fetched will trigger a `setState` on the `withOnyx` HOC. This might cause re-renders on the initial mounting, preventing the component from mounting/rendering in reasonable time, making your app feel slow and even delaying animations.
Copy file name to clipboardExpand all lines: lib/withOnyx/index.tsx
+4-15Lines changed: 4 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ import connectionManager from '../OnyxConnectionManager';
15
15
16
16
// This is a list of keys that can exist on a `mapping`, but are not directly related to loading data from Onyx. When the keys of a mapping are looped over to check
17
17
// if a key has changed, it's a good idea to skip looking at these properties since they would have unexpected results.
* If we have a pending merge for a key it could mean that data is being set via Onyx.merge() and someone expects a component to have this data immediately.
97
93
*
@@ -247,15 +243,8 @@ export default function <TComponentProps, TOnyxProps>(
0 commit comments