Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@react macro fails when using an ADT with backticks as state #475

Open
taig opened this issue Apr 17, 2021 · 2 comments
Open

@react macro fails when using an ADT with backticks as state #475

taig opened this issue Apr 17, 2021 · 2 comments
Milestone

Comments

@taig
Copy link

taig commented Apr 17, 2021

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]  ^
@taig taig changed the title @react macro fails when using an ADT with backticks as props @react macro fails when using an ADT with backticks as state Apr 18, 2021
@shadaj
Copy link
Owner

shadaj commented Apr 21, 2021

@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.

@shadaj shadaj added the bug label Apr 21, 2021
@taig
Copy link
Author

taig commented Apr 21, 2021

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.

@shadaj shadaj added this to the v0.7.0 milestone May 20, 2021
@shadaj shadaj added the facade label Sep 10, 2021
@shadaj shadaj modified the milestones: v0.7.0, Backlog Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants