linebender / linebender/druid

Druid book: what should go in `Data`?

Open
#1,337 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion docs
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.