Skip to content

Commit b5c1f3d

Browse files
authored
docs: DOC-1127: Clarify that all components re-render on state changes and emphasize use_memo for expensive calculations (#1291)
…s and emphasize use_memo for expensive calculations
1 parent c29fbfc commit b5c1f3d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

plugins/ui/docs/add-interactivity/render-cycle.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ After you trigger a render, `deephaven.ui` runs the component functions and then
6464

6565
This process is recursive: if the updated component returns some other component, `deephaven.ui` will render that component next, and if that component also returns something, it will render that component next, and so on. The process will continue until there are no more nested components.
6666

67+
> [!Note]
68+
> In the current implementation, when any state changes in a component tree, **all components re-render from the root down to the leaf nodes**. This means if a child component's state updates, the parent and all siblings will also re-render. While this ensures consistency, it's important to use `ui.use_memo` for expensive calculations to avoid re-computing values unnecessarily on every render.
69+
6770
Rendering must always be a [pure](../describing/pure_components.md) calculation:
6871

6972
- Same inputs, same output. Given the same inputs, a component should always return the output.

0 commit comments

Comments
 (0)