From c83690ff140da4a42ba9cb9f4691799e81d0664a Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 7 Oct 2024 12:29:10 -0400 Subject: [PATCH] storybook: Wire up HTTP client (#18818) This PR wires up the HTTP client in the Storybook. Release Notes: - N/A --- Cargo.lock | 1 + crates/storybook/Cargo.toml | 1 + crates/storybook/src/storybook.rs | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 0715c64984713..9deb937370f95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10998,6 +10998,7 @@ dependencies = [ "theme", "title_bar", "ui", + "ureq_client", ] [[package]] diff --git a/crates/storybook/Cargo.toml b/crates/storybook/Cargo.toml index 3b10d6331b689..b05c7692f9529 100644 --- a/crates/storybook/Cargo.toml +++ b/crates/storybook/Cargo.toml @@ -35,6 +35,7 @@ strum = { workspace = true, features = ["derive"] } theme.workspace = true title_bar = { workspace = true, features = ["stories"] } ui = { workspace = true, features = ["stories"] } +ureq_client.workspace = true [dev-dependencies] gpui = { workspace = true, features = ["test-support"] } diff --git a/crates/storybook/src/storybook.rs b/crates/storybook/src/storybook.rs index a8997498a5776..a77602efcca8b 100644 --- a/crates/storybook/src/storybook.rs +++ b/crates/storybook/src/storybook.rs @@ -4,6 +4,8 @@ mod assets; mod stories; mod story_selector; +use std::sync::Arc; + use clap::Parser; use dialoguer::FuzzySelect; use gpui::{ @@ -17,6 +19,7 @@ use simplelog::SimpleLogger; use strum::IntoEnumIterator; use theme::{ThemeRegistry, ThemeSettings}; use ui::prelude::*; +use ureq_client::UreqClient; use crate::app_menus::app_menus; use crate::assets::Assets; @@ -65,6 +68,13 @@ fn main() { gpui::App::new().with_assets(Assets).run(move |cx| { load_embedded_fonts(cx).unwrap(); + let http_client = UreqClient::new( + None, + "zed_storybook".to_string(), + cx.background_executor().clone(), + ); + cx.set_http_client(Arc::new(http_client)); + settings::init(cx); theme::init(theme::LoadThemes::All(Box::new(Assets)), cx);