@react macro fails when using an ADT with backticks as state
taig opened this issue · 2 comments
taig commented
import slinky.core.Component
import slinky.core.annotations.react
import slinky.core.facade.ReactElement
sealed abstract class Dimension
object Dimension {
final case object `8x24` extends Dimension
}
@react
class MyComponent extends Component {
override type Props = Unit
case class State(d: Dimension)
override def initialState: State = ???
override def render(): ReactElement = ???
}
[error] MyComponent.scala:13:2: could not find implicit value for parameter sr: slinky.core.StateReaderProvider
[error] @react
[error] ^
shadaj commented
@taig thanks for the bug report! Do you see the same issue if you use the classic ComponentWrapper
style? I ask because the compile error seems to be an issue with state reader/writers, not actually the @react
macro.
taig commented
Yes, indeed. Sorry, I got too inspired by a similar issue here. The actual problem is the implicit materialization of the Provider
, i.e. explicitly writing out the ComponentWrapper
will have the same issue.