Commands are not proccessed after update
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
to reproduce:
make sure after 1sec window receives no events (extend the time if needed).
"send command in update" will be logged
but "got command" will only be logged after next window event
```rust
use std::time::Duration;
use druid::widget::prelude::*;
use druid::{AppLauncher, Selector, WindowDesc};
use tracing::info;
struct CustomWidget;
const DOIT: Selector = Selector::new("druid-issue.commands-not-in-update");
impl Widget<()> for CustomWidget {
fn event(&mut self, ctx: &mut EventCtx, event: &Event, _data: &mut (), _env: &Env) {
match event {
Event::WindowConnected => {
ctx.request_timer(Duration::from_millis(1000));
}
Event::Timer(_) => {
ctx.request_update();
}
Event::Command(cmd) if cmd.is(DOIT) => {
info!("got command");
}
_ => {}
}
}
fn lifecycle(&mut self, _ctx: &mut LifeCycleCtx, _event: &LifeCycle, _data: &(), _env: &Env) {}
fn update(&mut self, ctx: &mut UpdateCtx, _old_data: &(), _data: &(), _env: &Env) {
info!("send command in update");
ctx.submit_command(DOIT);
}
fn layout(
&mut self,
_layout_ctx: &mut LayoutCtx,
_bc: &BoxConstraints,
_data: &(),
_env: &Env,
) -> Size {
Size::ZERO
}
fn paint(&mut self, _ctx: &mut PaintCtx, _data: &(), _env: &Env) {}
}
pub fn main() {
AppLauncher::with_window(WindowDesc::new(CustomWidget))
.log_to_console()
.launch(())
.expect("launch failed");
}
```
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
Run the supplied Rust reproduction and trace the Event::Timer, request_update, update, and Command handling paths. Done means the "got command" log appears immediately after "send command in update", without waiting for another window event.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100