-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
If you have a stylesheet like this:
~SHEET"""
"comments-stack" do
toolbar(content: :toolbar)
toolbar(content: :toolbar_button)
toolbar(content: :cancel_button)
end
and only conditionally show one of the toolbar items like:
<%= if @show_cancel do %>
<ToolbarItem template="cancel_button" placement="cancellationAction">
<Button phx-click="cancel">Close</Button>
</ToolbarItem>
<% end %>
you'll get ToolbarError.badChildCount(0)
thrown at runtime.
This ended up crashing my app, as I use a custom registry, which gets this default implementation:
extension CustomRegistry where ErrorView == Never {
/// A default implementation that falls back to the default framework error view.
public static func errorView(for error: Error) -> Never {
fatalError()
}
}
Not a big issue, as I can work around this by putting then <%= if ... %>
around the button rather than the toolbar item, but I wouldn't have expected this to throw an error (or crash the app). It'd be nice if this was handled more gracefully.
Library Version
0.4.0-rc.1
Xcode Version
Version 16.2 (16C5032a)
Swift Version
No response
On which device or simulator are you running into the problem?
iPhone
Target Device Operating System Version
iOS 18
Relevant log output
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working