![]() * Unit tests for add_style and component styles with foreach The styles should be correctly applied for components that are rendered as part of a foreach. * [REF-2802] Foreach should respect modifications to children Components are mutable, and there is logic that depends on walking through the component tree and making modifications to components along the way. These modifications _must_ be respected by foreach for consistency. Modifications necessary to fix the bug: * Change the hash function in `_render` to get a hash over the render_fn's `__code__` object. This way we get a stable hash without having to call the render function with bogus values. * Call the render function once during `create` and save the result as a child of the Foreach component (tree walks will modify this instance). * Directly render the original (and possibly modified) child component instead of calling the render_fn again and creating a new component instance at render time. Additional changes because they're nice: * Deprecate passing `**props` to `rx.foreach`. No one should have been doing this anyway, because it just does not work in any reasonable way. * Raise `ForeachVarError` when the iterable type is Any * Raise `ForeachRenderError` when the render function does not take 1 or 2 args. * Link to the foreach component docs when either of those errors are hit. * Change the `iterable` arg in `create` to accept `Var[Iterable] | Iterable` for better typing support (and remove some type: ignore comments) * Simplify `_render` and `render` methods -- remove unused and potentially confusing code. * Fixup: `to_bytes` requires `byteorder` arg before py3.11 |
||
---|---|---|
.. | ||
base | ||
core | ||
datadisplay | ||
el | ||
forms | ||
graphing | ||
layout | ||
lucide | ||
media | ||
radix | ||
typography | ||
__init__.py | ||
test_component_future_annotations.py | ||
test_component_state.py | ||
test_component.py | ||
test_tag.py |