Skip to content

Commit 6d68b31

Browse files
committed
docs: add description for null placeholder
1 parent 606125a commit 6d68b31

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ It receives the following props:
166166
- All fields of the [`FixedSizeNodePublicState`](#types) object.
167167
- `treeData: any` - any data provided via the `itemData` property of the `FixedSizeTree` component.
168168

169-
##### `placeholder: ReactNode`
169+
##### `placeholder: ReactNode | null`
170170

171171
This property receives any react node that will be displayed instead of a tree during the building process. This option should only be used if the tree building process requires too much time (which means you have a really giant amount of data, e.g. about a million nodes).
172172

@@ -176,6 +176,10 @@ Using this feature allows avoiding UI freezes; however, it may slightly increase
176176

177177
To see how it works, you can check the [BigData](./__stories__/BigData.story.tsx) story. Use `placeholder` tool to add and remove placeholder.
178178

179+
If you have an asynchronous giant tree and want to use profits of `requestIdleCallback` but don't want placeholder to be shown on the first render (that is probably quite small because all other data will be loaded asynchronously), set `placeholder` to `null`. No placeholder will be shown on the first render but the `requestIdleCallback` building will be enabled and allow avoiding freezes on tree re-building when tree becomes bigger.
180+
181+
To see how it works you can check the [AsyncDataIdle](./__stories__/AsyncDataIdle.story.tsx) story. It uses the `null` placeholder, so no text is shown for the first build but async requests don't block the UI.
182+
179183
##### `buildingTaskTimeout: number`
180184

181185
This option works in tandem with the `placeholder` option. With it, you can set the task timeout for the `requestIdleCallback`. The `buildingTaskTimeout` will be sent directly as the `requestIdleCallback`'s `timeout` option.

0 commit comments

Comments
 (0)