Partially Fix Hotreload (#2557)
* fix: template names * fix: hot reload "resets" after reload * revision: ensure all paths are split by `/` --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
9567674a63
commit
7f6f0de085
8 files changed
+26
-17
No files matched your search
@@ -305,10 +305,7 @@ pub fn template_location(old_start: proc_macro2::LineColumn, file: &Path) -> Str
|
||||
let line = old_start.line;
|
||||
let column = old_start.column + 1;
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let path = file.to_string_lossy().to_string();
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
// Always ensure the path components are separated by `/`.
|
||||
let path = file
|
||||
.components()
|
||||
.map(|c| c.as_os_str().to_string_lossy())
|
||||
|
||||
@@ -79,16 +79,13 @@ impl<'a> TemplateRenderer<'a> {
|
||||
// Get the root:column:id tag we'll use as the ID of the template
|
||||
let root_col = self.get_root_col_id();
|
||||
|
||||
// Replace `\\` to `/` and then replace `\` to `/`
|
||||
quote! {
|
||||
concat!(
|
||||
file!(),
|
||||
":",
|
||||
line!(),
|
||||
":",
|
||||
column!(),
|
||||
":",
|
||||
#root_col
|
||||
)
|
||||
{
|
||||
const PATH: &str = dioxus_core::const_format::str_replace!(file!(), "\\\\", "/");
|
||||
const NORMAL: &str = dioxus_core::const_format::str_replace!(PATH, '\\', "/");
|
||||
dioxus_core::const_format::concatcp!(NORMAL, ':', line!(), ':', column!(), ':', #root_col)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user