fix autofmt: don't panic when writing blocks out without a srcfile (#2854)

* fix: don't panic when writing blocks out
* also fix serialization for hotreload
* fix windows line endings
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-08-16 21:55:30 -07:00
1 parent b47a6cf83e
commit 4963aa3118
9 files changed
+142 -46

No files matched your search

-2
View File
@@ -16,7 +16,6 @@ pub use ws_receiver::*;
/// A message the hot reloading server sends to the client
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(bound(deserialize = "'de: 'static"))]
pub enum DevserverMsg {
/// Attempt a hotreload
/// This includes all the templates/literals/assets/binary patches that have changed in one shot
@@ -47,7 +46,6 @@ pub enum ClientMsg {
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(bound(deserialize = "'de: 'static"))]
pub struct HotReloadMsg {
pub templates: Vec<HotReloadTemplateWithLocation>,
pub assets: Vec<PathBuf>,
+2 -2
View File
@@ -51,8 +51,8 @@ impl NativeReceiver {
match res {
Ok(res) => match res {
Message::Text(text) => {
let leaked: &'static str = Box::leak(text.into_boxed_str());
let msg = serde_json::from_str::<DevserverMsg>(leaked);
// let leaked: &'static str = Box::leak(text.into_boxed_str());
let msg = serde_json::from_str::<DevserverMsg>(&text);
if let Ok(msg) = msg {
return Some(Ok(msg));
}