From 73b8c7872e71d8b22aee94c4990747bca149d32a Mon Sep 17 00:00:00 2001 From: Bart Toersche Date: Wed, 27 Mar 2024 07:45:29 +0100 Subject: [PATCH] Fix: Small fix for location hash/fragment (#2464) --- leptos_dom/src/helpers.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/leptos_dom/src/helpers.rs b/leptos_dom/src/helpers.rs index 99fe8a4e28..c9f5e4502b 100644 --- a/leptos_dom/src/helpers.rs +++ b/leptos_dom/src/helpers.rs @@ -39,7 +39,10 @@ pub fn location_hash() -> Option { if is_server() { None } else { - location().hash().ok().map(|hash| hash.replace('#', "")) + location().hash().ok().map(|hash| match hash.chars().next() { + Some('#') => hash[1..].to_string(), + _ => hash, + }) } }