|
@@ -19,7 +19,7 @@ namespace Spry {
|
|
|
|
|
|
|
|
private static Dictionary<Type, ComponentTemplate> templates;
|
|
private static Dictionary<Type, ComponentTemplate> templates;
|
|
|
private static Mutex templates_lock = Mutex();
|
|
private static Mutex templates_lock = Mutex();
|
|
|
- public string instance_id { get; internal set; default = Uuid.string_random(); }
|
|
|
|
|
|
|
+ public string context_key { get; internal set; default = Uuid.string_random(); }
|
|
|
|
|
|
|
|
public abstract string markup { get; }
|
|
public abstract string markup { get; }
|
|
|
public virtual StatusCode get_status() {
|
|
public virtual StatusCode get_status() {
|
|
@@ -282,7 +282,7 @@ namespace Spry {
|
|
|
var context = new ComponentContext() {
|
|
var context = new ComponentContext() {
|
|
|
type_name = this.get_type().name(),
|
|
type_name = this.get_type().name(),
|
|
|
timestamp = new DateTime.now_utc(),
|
|
timestamp = new DateTime.now_utc(),
|
|
|
- instance_id = instance_id,
|
|
|
|
|
|
|
+ context_key = context_key,
|
|
|
data = data
|
|
data = data
|
|
|
};
|
|
};
|
|
|
var context_blob = _cryptography_provider.author_component_context_blob(context);
|
|
var context_blob = _cryptography_provider.author_component_context_blob(context);
|
|
@@ -387,7 +387,8 @@ namespace Spry {
|
|
|
node.set_attribute("sse-swap", @"_spry-dynamic-$name");
|
|
node.set_attribute("sse-swap", @"_spry-dynamic-$name");
|
|
|
node.set_attribute("hx-swap", "outerHTML");
|
|
node.set_attribute("hx-swap", "outerHTML");
|
|
|
if(!node.has_attribute("id")) {
|
|
if(!node.has_attribute("id")) {
|
|
|
- node.set_attribute("id", @"_spry-dynamic-$name-$instance_id");
|
|
|
|
|
|
|
+ node.set_attribute("id", @"_spry-dynamic-$name-$context_key");
|
|
|
|
|
+ node.set_attribute("id", @"_spry-dynamic-$name-$context_key");
|
|
|
}
|
|
}
|
|
|
node.remove_attribute("spry-dynamic");
|
|
node.remove_attribute("spry-dynamic");
|
|
|
}
|
|
}
|
|
@@ -403,7 +404,8 @@ namespace Spry {
|
|
|
if(node.get_attributes().keys.any(a => a.has_prefix("spry-per-")) || has_any_parent_where(node, n => n.get_attributes().keys.any(a => a.has_prefix("spry-per-")))) {
|
|
if(node.get_attributes().keys.any(a => a.has_prefix("spry-per-")) || has_any_parent_where(node, n => n.get_attributes().keys.any(a => a.has_prefix("spry-per-")))) {
|
|
|
throw new ComponentError.INVALID_TEMPLATE("The spry-unique attribute is not valid on any element or child of any element with a spry-per attribute");
|
|
throw new ComponentError.INVALID_TEMPLATE("The spry-unique attribute is not valid on any element or child of any element with a spry-per attribute");
|
|
|
}
|
|
}
|
|
|
- node.set_attribute("id", @"_spry-unique-$counter-$instance_id");
|
|
|
|
|
|
|
+ node.set_attribute("id", @"_spry-unique-$counter-$context_key");
|
|
|
|
|
+ node.set_attribute("id", @"_spry-unique-$counter-$context_key");
|
|
|
counter++;
|
|
counter++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|