File tree Expand file tree Collapse file tree
core/renzora_scripting/src/backends
editor/renzora_editor/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ name: Build
33on :
44 workflow_dispatch :
55 push :
6- branches :
7- - main
86 tags :
97 - " v*"
108
Original file line number Diff line number Diff 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 } ;
Original file line number Diff line number Diff 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 } ;
Original file line number Diff line number Diff 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.
143145fn 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
You can’t perform that action at this time.
0 commit comments