Skip to content

Commit 593825f

Browse files
committed
Fix script hot-reload toast spam on project load
needs_reload() returned true for uncached scripts, causing the 0.5s hot-reload timer to fire endlessly in editor mode where scripts never execute. Also batch multiple reload toasts into a single summary and remove automatic CI runs on push to main.
1 parent 6588ab8 commit 593825f

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Build
33
on:
44
workflow_dispatch:
55
push:
6-
branches:
7-
- main
86
tags:
97
- "v*"
108

crates/core/renzora_scripting/src/backends/lua.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ impl ScriptBackend for LuaBackend {
263263

264264
fn needs_reload(&self, path: &Path) -> bool {
265265
let cache = match self.cache.read() { Ok(c) => c, Err(_) => return false };
266-
let Some(cached) = cache.get(path) else { return true };
266+
// Not in cache = never loaded yet, not a "reload" scenario
267+
let Some(cached) = cache.get(path) else { return false };
267268
// VFS/rpak scripts don't change at runtime — no reload needed once cached
268269
if self.file_reader.is_some() { return false; }
269270
let Ok(meta) = std::fs::metadata(path) else { return false };

crates/core/renzora_scripting/src/backends/rhai.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ impl ScriptBackend for RhaiBackend {
177177

178178
fn needs_reload(&self, path: &Path) -> bool {
179179
let cache = match self.cache.read() { Ok(c) => c, Err(_) => return false };
180-
let Some(cached) = cache.get(path) else { return true };
180+
// Not in cache = never loaded yet, not a "reload" scenario
181+
let Some(cached) = cache.get(path) else { return false };
181182
if self.file_reader.is_some() { return false; }
182183
let Ok(meta) = std::fs::metadata(path) else { return false };
183184
let Ok(modified) = meta.modified() else { return false };

crates/editor/renzora_editor/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,17 @@ impl Plugin for RenzoraEditorPlugin {
140140
}
141141

142142
/// Picks up script hot-reload events and shows toast notifications.
143+
/// When many scripts reload at once (e.g. project load), shows a single
144+
/// summary toast instead of flooding the screen.
143145
fn show_script_reload_toasts(
144146
reload_events: Option<Res<renzora_scripting::ScriptReloadEvents>>,
145147
mut toasts: ResMut<renzora_ui::Toasts>,
146148
) {
147149
let Some(events) = reload_events else { return };
148-
for name in &events.reloaded {
149-
toasts.success(format!("Reloaded {}", name));
150+
match events.reloaded.len() {
151+
0 => {}
152+
1 => { toasts.success(format!("Reloaded {}", events.reloaded[0])); }
153+
n => { toasts.success(format!("Reloaded {} scripts", n)); }
150154
}
151155
}
152156

0 commit comments

Comments
 (0)