From 2ac1123a2c8bbb34ead4b240bb826e79b2dfcb5d Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 26 Nov 2026 05:58:25 +0000 Subject: [PATCH] craft-menu: the rebuild retry reads the framework's Instant, which is the browser clock on wasm --- crates/menu/src/driver.rs | 3 ++- crates/ui-contract/src/runtime/motion.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/menu/src/driver.rs b/crates/menu/src/driver.rs index e12f7f2c7c..53e6aa54ca 100644 --- a/crates/menu/src/driver.rs +++ b/crates/menu/src/driver.rs @@ -3,11 +3,12 @@ use std::borrow::Cow; use std::collections::HashSet; use std::sync::{Arc, Mutex, MutexGuard, PoisonError}; -use std::time::{Duration, Instant}; +use std::time::Duration; use craft_keymap::{Chord, CommandRef, Key, Mods}; use craft_ui::contract::{MemoKey, MemoProps}; use craft_ui::menu::Alternate; +use craft_ui::runtime::motion::Instant; use craft_ui::runtime::windows::{KeyEquivalent, WindowAction, WindowHost}; use crate::layout::{Clash, Layout}; diff --git a/crates/ui-contract/src/runtime/motion.rs b/crates/ui-contract/src/runtime/motion.rs index 5fb7df0beb..b7fad9cce2 100644 --- a/crates/ui-contract/src/runtime/motion.rs +++ b/crates/ui-contract/src/runtime/motion.rs @@ -243,10 +243,14 @@ pub(crate) struct Wanted { wake: Option, } +/// The instant type [`now`] returns: `std::time::Instant` on native targets, a clock that works in the browser on +/// wasm. +pub use web_time::Instant; + /// The wall clock's reading, for a host that drives a store on real time (`ShellApp::tick`). It is the one place /// outside a pass that reads the clock. -pub fn now() -> web_time::Instant { - web_time::Instant::now() +pub fn now() -> Instant { + Instant::now() } /// Marks the running viewport as having an animation that is not at its end value.