diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-08 19:58:48 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-08 19:58:48 +0200 |
| commit | 7e22857bc903f24823ae8c02affdd879714c3a26 (patch) | |
| tree | ad718fa5da08b132e1d6f589a4be34c34105583c | |
| parent | d0a2f9b05a5df95f3d2800cb899c998d3c8d5fb6 (diff) | |
fix component attribute linking
| -rw-r--r-- | src/z/Component.zig | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/z/Component.zig b/src/z/Component.zig index 122975f..70d6e1d 100644 --- a/src/z/Component.zig +++ b/src/z/Component.zig @@ -105,17 +105,19 @@ pub fn exportLinks(self: *const Self) void { fn linkAttributes(self: *const Self, attributes: []const Attribute) []const Attribute { var linked: []const Attribute = &.{}; - for (attributes) |*attr| { + for (attributes) |attr| { if (attr.value.len > 0 and attr.value[0] == '@') { const event_handler = @field(self.link, attr.value[1..]); - const attribute: []const Attribute = &.{.{ + const attribute: Attribute = .{ .name = attr.name, .value = std.fmt.comptimePrint( "wasm_handle_event(\"export::{s}::{s}\", event, {})", .{ self.name, attr.value[1..], handlerNeedsEvent(event_handler) }, ), - }}; - linked = linked ++ attribute; + }; + linked = linked ++ .{attribute}; + } else { + linked = linked ++ .{attr}; } } return linked; |