Druid book: what should go in `Data`?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
Every time I used druid I just put as much in data unless it is some internal state like a cache.
Sometimes this is not really preferable, like with the animation example. Here it is preferred to put it in the internal state because no other widget really needs to know the animation state.
A couple of questions arise from this as well:
* What happens if other widgets DO need to know the animation state? Or in general a widgets internal state? Should the state be put in `Data` in this case or should another method be used.
* In general what kind of data should be put in `Data`? For a textbox might seem clear, but what is in the textbox could also be seen as some internal state.
I guess "if the widget modifies some variable that is interesting to other widgets/the app" might be a simple answer but it needs to be written down either way.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Druid book's existing discussion of Data, widget state, and the animation example. Resolve when internal state should remain local versus be exposed through Data, including cases where other widgets need it, and document the resulting guidance for textbox and similar state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100