scalajs-spa-tutorial icon indicating copy to clipboard operation
scalajs-spa-tutorial copied to clipboard

Avoid SBT macro recompilation issue

Open mlvn23 opened this issue 9 years ago • 1 comments

If you add a method in the API, you'll get an error like this:

Request path: spatutorial/shared/Api/getTodos Request path: spatutorial/shared/Api/getMessage Request path: spatutorial/shared/Api/motd Sending 4 Todo items [error] p.c.s.n.PlayDefaultUpstreamHandler - Cannot invoke the action scala.MatchError: Request(WrappedArray(spatutorial, shared, Api, getMessage),Map (what -> java.nio.HeapByteBuffer[pos=0 lim=3 cap=3])) (of class autowire.Core$Re quest)

SBT appears to have an issue in not incrementally compiling macros when its dependents change. So in this case, the Router is dependent on Api trait, and if that trait changes, all invocation to the Router needs to be recompiled. The original Router invocation was in Application, but Application will probably not change when you change the Api service. As a work-around, move it here because if you change the Api trait, you will need to change the ApiService implementation, so this entire file (including the router invocation) would have to be recompiled.

mlvn23 avatar Oct 08 '15 18:10 mlvn23

This would fix #23

mlvn23 avatar Oct 08 '15 18:10 mlvn23