In order to reduce the size of Scala.js code, we could add of the option of generating native Scala.js traits/classes to hold query results instead of Scala case classes.
Ideally, these would behave as facades into the JS object of the result, using js.Array instead of List, js.UndefOr instead of Option, etc. We wouldn't even need a Decoder, which means revising the base Query type.
Things that may be tricky:
- Generating
Reusability, Eq and Show instances (we do have all the info to generate them though).
- Generating lenses. Again, we have everything to generate them, but we would have to clone objects, I don't think the
Focus macro would work.
It remains to be seen how much of an improvement this would be, in order to evaluate it it's worth the effort.
In order to reduce the size of Scala.js code, we could add of the option of generating native Scala.js traits/classes to hold query results instead of Scala case classes.
Ideally, these would behave as facades into the JS object of the result, using
js.Arrayinstead ofList,js.UndefOrinstead ofOption, etc. We wouldn't even need aDecoder, which means revising the baseQuerytype.Things that may be tricky:
Reusability,EqandShowinstances (we do have all the info to generate them though).Focusmacro would work.It remains to be seen how much of an improvement this would be, in order to evaluate it it's worth the effort.