on some of my components, i am running into "java.lang.IllegalStateException: You can't change tag attribute because it was already passed to the downstream
at kotlinx.html.consumers.DelayedConsumer.onTagAttributeChange(delayed-consumer.kt:16)" . details in thread
Reuben Firmin
11/29/2023, 12:02 PM
Copy code
class Sidebar(consumer: TagConsumer<*>): ASIDE(mapOf(
"class" to "absolute top-30 left-0 z-40 w-64 h-screen transition-transform -translate-x-full sm:translate-x-0",
// XXX this doesn't set it
// "aria-label" to "Sidebar",
"id" to "default-sidebar"), consumer) {
fun render(block: Sidebar.() -> Unit) {
// XXX this breaks with exception
attributes["aria-label"] = "Sidebar"
// id = "default-sidebar"
div("h-full px-3 py-4 overflow-y-auto bg-gray-50 dark:bg-gray-800") {
this@Sidebar.block()
}
}
}
fun FlowContent.sidebar(block: Sidebar.() -> Unit) {
Sidebar(consumer).render(block)
}
Reuben Firmin
11/29/2023, 12:02 PM
it is blowing up when i attempt to set attributes in the render function - which would be ok if i could set attributes when creating the tag, but i cannot. of the three at the top, only class gets set