fix(boot): stamp generated entry actions with the final entry context

This commit is contained in:
alex authored and Alex Zenla committed 2026-10-04 17:53:13 -07:00
1 parent 5f81a99d21
commit ab9f3cd2d3
2 files changed
+4 -9

No files matched your search

+1 -4
View File
@@ -196,15 +196,12 @@ impl BootableEntry {
} }
/// Create a variant of this entry, with the name suffixed by `suffix` and using `context`. /// Create a variant of this entry, with the name suffixed by `suffix` and using `context`.
/// The actions of the entry are stamped with `context`, the same as the list generator. /// The actions of the entry are stamped with `context` when the entry is booted.
/// Variants of the same entry keep the sort key of this entry, so they stay grouped /// Variants of the same entry keep the sort key of this entry, so they stay grouped
/// together in the order they were created in. /// together in the order they were created in.
pub fn variant(&self, suffix: &str, context: Rc<SproutContext>) -> Self { pub fn variant(&self, suffix: &str, context: Rc<SproutContext>) -> Self {
let mut entry = self.clone(); let mut entry = self.clone();
entry.name.push_str(suffix); entry.name.push_str(suffix);
entry.declaration.actions = context
.stamp_iter(entry.declaration.actions.iter())
.collect();
// Without any sort key, the name is used to sort, which differs between variants. // Without any sort key, the name is used to sort, which differs between variants.
// Pin the sort key to the name of this entry to keep the variants together. // Pin the sort key to the name of this entry to keep the variants together.
if entry.sort_key.is_none() && entry.declaration.sort_key.is_none() { if entry.sort_key.is_none() && entry.declaration.sort_key.is_none() {
+3 -5
View File
@@ -20,11 +20,9 @@ pub fn generate(
context.insert(combination); context.insert(combination);
let context = context.freeze(); let context = context.freeze();
// Stamp the entry title and actions from the template. // The actions are stamped with the final context of the entry when it is booted,
let mut entry = list.entry.clone(); // so that variants and the values of the entry can override the values of the generator.
let entry = list.entry.clone();
// Stamp all the actions this entry references.
entry.actions = context.stamp_iter(entry.actions.into_iter()).collect();
// Push the entry into the list with the new context. // Push the entry into the list with the new context.
entries.push(BootableEntry::new( entries.push(BootableEntry::new(