String packs: the site tab's delivery layer lives in app.rs, so a host without the net feature builds again (a generated app's cargo check failed on the net-gated store_commands module)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
38b877f03a
commit
198b1160f2
3 changed files with 10 additions and 9 deletions
|
|
@ -324,6 +324,14 @@ pub(crate) fn hooks(app: &AppHandle) -> Arc<dyn SiteHooks> {
|
|||
}
|
||||
|
||||
/// The app's config ([`run_app`] must be running).
|
||||
/// The document-start script that gives a new site tab the current string packs (none when the
|
||||
/// shell never applied any, or the app has no store). Part of the normal page layers, so safe mode
|
||||
/// leaves it out.
|
||||
fn strings_layer(app: &AppHandle) -> Option<String> {
|
||||
let stored = app.try_state::<crate::store::Store>()?.strings().delivery()?;
|
||||
Some(crate::store::delivery_script(config(app).site.hosts, &stored, false))
|
||||
}
|
||||
|
||||
pub fn config(app: &AppHandle) -> AppConfig {
|
||||
host_state(app).config
|
||||
}
|
||||
|
|
@ -1011,7 +1019,7 @@ fn tab_builder(app: &AppHandle, hooks: &Arc<dyn SiteHooks>, tab: &NewTab, url: U
|
|||
}
|
||||
// Safe mode: the safe set (the tab bridge) instead of the app's page layers.
|
||||
// The string packs' delivery goes first, before the page runtime reads it (not in safe mode).
|
||||
let layers = || crate::store_commands::strings_init_script(app).into_iter().chain(hooks.init_scripts(app, tab)).collect::<Vec<_>>();
|
||||
let layers = || strings_layer(app).into_iter().chain(hooks.init_scripts(app, tab)).collect::<Vec<_>>();
|
||||
for script in crate::safe::layer(crate::safe::active(), layers, || hooks.safe_init_scripts(app, tab)) {
|
||||
builder = builder.initialization_script(script);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue