From ab1acf7ae2ef451c1cab98bdb4561e34011434ba Mon Sep 17 00:00:00 2001 From: Gaauwe Rombouts Date: Wed, 29 Jul 2026 12:07:58 +0200 Subject: [PATCH] ui: Fix scrollbar animation timing on web (#61786) Use `web_time::Instant` instead of `std::time::Instant` when advancing scrollbar animations. This uses the web platform's compatible clock in WASM builds. Release Notes: - N/A --- Cargo.lock | 1 + crates/ui/Cargo.toml | 1 + crates/ui/src/components/scrollbar.rs | 8 ++------ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 00c4a0d9bb..3ae2da6898 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19868,6 +19868,7 @@ dependencies = [ "theme", "theme_settings", "ui_macros", + "web-time", "windows 0.61.3", ] diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml index ac9a2bbc60..656b068d3e 100644 --- a/crates/ui/Cargo.toml +++ b/crates/ui/Cargo.toml @@ -29,6 +29,7 @@ smallvec.workspace = true strum.workspace = true theme.workspace = true ui_macros.workspace = true +web-time.workspace = true gpui_util.workspace = true [target.'cfg(windows)'.dependencies] diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs index dde9312334..a142c439f4 100644 --- a/crates/ui/src/components/scrollbar.rs +++ b/crates/ui/src/components/scrollbar.rs @@ -1,9 +1,5 @@ -use std::{ - any::Any, - fmt::Debug, - ops::Not, - time::{Duration, Instant}, -}; +use std::{any::Any, fmt::Debug, ops::Not, time::Duration}; +use web_time::Instant; use gpui::{ Along, Anchor, App, AppContext as _, Axis as ScrollbarAxis, BorderStyle, Bounds, ContentMask,