spxbhuhb / adaptive

Consolidated full-stack application development library for Kotlin
Apache License 2.0
0 stars 0 forks source link

Passing instructions fails when there are no instructions #29

Closed toth-istvan-zoltan closed 5 days ago

toth-istvan-zoltan commented 1 week ago

Fix handling of missing vararg arguments when passing instructions to other fragments.

This function fails when it is called with no instructions passed:

@Adaptive
fun layoutExample(title: String, vararg instructions: AdaptiveInstruction, @Adaptive example: () -> Unit) : AdaptiveFragment {
    column(*instructions) {
    }
}

This one works:

@Adaptive
fun layoutExample(title: String, vararg instructions: AdaptiveInstruction = emptyArray(), @Adaptive example: () -> Unit) : AdaptiveFragment {
    column(*instructions) {
    }
}
toth-istvan-zoltan commented 5 days ago

When not present, state definition transform adds the emptyArray() default value.