Add option to disable wrapping scalajs-react props in Callback #620
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scalajs-react added a feature, called Effect Agnosticism, to support arbitrary effects instead of its own
Callback
andCallbackTo
types. For example, you can use Cats Effect or ZIO.Unfortunately, when scalajs-react is imported in this mode, the Callback classes are not in the same package so the code generated by the Converter doesn't compile. Even if it did, re-wrapping the effect type that you actually use in Callback is even worse than having to unwrap it into an impure function.
Ideally the Converter would support effect-agnostic scalajs-react as a new flavor, but doing so requires outputting higher-kinded type parameters in various places so it's a bit of an undertaking.
As a more immediate solution this PR just adds an option to disable the wrapping of callback-style props in the
Callback
type so the user could manually unwrap their effect type into impure functions but keep using all the other facilities of the ScalajsReact flavor.