Repository navigation
Dars Framework v1.5.6
Release Notes v1.5.6
Enhanced
useDynamicSupport & StateV2 Fixes
Installation
pip install --upgrade dars-frameworkWhat's New
1. Expanded useDynamic Support for Built-in Components
useDynamic now works with all properties of built-in components, including:
Image & Link Components
# Dynamic image source and alt text
Image(
src=useDynamic("product.imageUrl"),
alt=useDynamic("product.name")
)
# Dynamic link href and text
Link(
href=useDynamic("navigation.url"),
text=useDynamic("navigation.label")
)Boolean Attributes
All boolean attributes now support dynamic binding:
# Dynamic disabled state
Button(
text="Submit",
disabled=useDynamic("form.isSubmitting")
)
# Dynamic checked state
Checkbox(
checked=useDynamic("settings.notifications"),
label="Enable Notifications"
)
# Dynamic readonly and required
Input(
value=useDynamic("user.email"),
readonly=useDynamic("form.isLocked"),
required=useDynamic("form.emailRequired")
)Supported Boolean Properties:
disabled- Button, Input, Textarea, Checkbox, RadioButton, Select, Sliderchecked- Checkbox, RadioButtonreadonly- Input, Textarearequired- Input, Textarea, Checkbox, RadioButton, Select
2. StateV2 increment() & decrement() Fixes
Fixed critical issues with StateV2 reactive operations:
Fixed Validation Error
Previously, increment() and decrement() only worked on properties named text. Now they work on any numeric property:
# Before: This would error
state = State("counter", count=0)
Button("Increment", on_click=state.count.increment(by=1)) # ❌ ValueError
# After: Works perfectly!
state = State("counter", count=0)
Button("Increment", on_click=state.count.increment(by=1)) # ✅ Works!Fixed Persistence Issue
Increment/decrement operations now correctly persist across multiple clicks:
state = State("counter", count=0)
# Before: Would increment 0→1, then stay at 1 forever
# After: Correctly increments 0→1→2→3→...
Button("Increment", on_click=state.count.increment(by=1))
Button("Decrement", on_click=state.count.decrement(by=1))Technical Details:
- Implemented client-side state value tracking in
window.Dars.getState() - State registry now maintains current values for all properties
increment()/decrement()usewindow.Dars.change()for proper state updates- Watchers and UI updates now trigger correctly on every operation
3. Documentation Updates
Enhanced Hooks Documentation
- Added comprehensive "Supported Properties" table showing which properties work with
useDynamicfor each component type - Documented boolean attribute support
Bug Fixes
StateV2 Increment/Decrement
- Issue:
increment()raisedValueErrorfor non-textproperties - Fix: Validation now checks if value is numeric (
intorfloat) instead of checking property name - Impact: All numeric state properties can now use
increment()anddecrement()
StateV2 State Persistence
- Issue: Increment operations stuck at first value (0→1, then stayed at 1)
- Fix: Implemented proper client-side state tracking and payload structuring
- Impact: Reactive operations now work correctly across multiple invocations
Breaking Changes
None.
What's Next
The enhanced useDynamic system and robust StateV2 operations pave the way for more advanced reactive patterns and state management features in future releases.