From 72b499a28ff8f089fecc87963561e32ec272ec26 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 12 Oct 2026 23:20:45 -0400 Subject: [PATCH] Tile grid overlay: gate rayon to native so the web build compiles (#4694) #4217 used rayon's par_iter in ui-egui unconditionally, but rayon is a native-only dependency there, so cargo xtask wasm failed on main. Co-authored-by: Claude Opus 5.5 --- crates/ui-egui/src/tile_overlay.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/ui-egui/src/tile_overlay.rs b/crates/ui-egui/src/tile_overlay.rs index 03d8156dde..731ddc06b8 100644 --- a/crates/ui-egui/src/tile_overlay.rs +++ b/crates/ui-egui/src/tile_overlay.rs @@ -21,6 +21,7 @@ use std::sync::Arc; use egui::{Align2, Color32, FontId, Painter, Shape, Stroke}; use photocraft_geom::{Rect as DRect, TILE_SIZE, TileCoord}; use photocraft_raster::{Surface, Tile}; +#[cfg(not(target_arch = "wasm32"))] use rayon::prelude::*; use crate::PhotocraftApp; @@ -70,11 +71,18 @@ pub fn tile_infos(s: &Surface, parallel: bool) -> Vec { by_ptr.entry(ptr(t)).or_insert(t); } let distinct: Vec<(usize, &Arc)> = by_ptr.into_iter().collect(); + // rayon is a native-only dependency; the web build hashes serially. + #[cfg(not(target_arch = "wasm32"))] let hashed: Vec<(usize, u64)> = if parallel { distinct.par_iter().map(|(p, t)| (*p, content_hash(t))).collect() } else { distinct.iter().map(|(p, t)| (*p, content_hash(t))).collect() }; + #[cfg(target_arch = "wasm32")] + let hashed: Vec<(usize, u64)> = { + let _ = parallel; + distinct.iter().map(|(p, t)| (*p, content_hash(t))).collect() + }; let hash_of: HashMap = hashed.into_iter().collect(); let mut count: HashMap = HashMap::new(); for (_, t) in s.tiles() {