ochrons on master
typo Merge pull request #73 from tem… (compare)
Hello, I am playing with scalajs-spa-tutorial and trying to run tests. sbt test
command produces
[error] Error: Cannot find module 'jsdom'
[error] at Function.Module._resolveFilename (module.js:489:15)
[error] at Function.Module._load (module.js:439:25)
[error] at Module.require (module.js:517:17)
[error] at require (internal/module.js:11:18)
[error] at [stdin]:39:13
[error] at [stdin]:95:3
[error] at ContextifyScript.Script.runInThisContext (vm.js:44:33)
[error] at Object.runInThisContext (vm.js:116:38)
[error] at Object.<anonymous> ([stdin]-wrapper:6:22)
[error] at Module._compile (module.js:573:30)
[info] Closure: 0 error(s), 0 warning(s)
org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: Node.js with JSDOM exited with code 1
Could you please suggest how to fix this? Thanks
package.json
in the project root, though
update()
when the state is changed, I didn't manage to come up with a way to do this with diode. Then I thought I try paths-scala-js, which seems to fit react better. My problem is, that when I add "eu.unicredit" %%% "paths-scala-js" % "0.4.4"
to scalajsDependencies
, then client-jsdeps.js
doesn't compile any more in the browser, I have two errors:
Error: Cannot find module 'function (factory, root) {
if (typeof define == "function" && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else if (typeof module != "undefined" && typeof exports == "object") {
// Node/CommonJS style
module.exports = factory();
} else {
// No AMD or CommonJS support so we place log4javascript in (probably) the global variable
root.log4javascript = factory();
}
}'
at s (client-jsdeps.js:sourcemap:16271)
at client-jsdeps.js:sourcemap:16369
Cannot read property 'getLogger' of undefined
at $c_Lspatutorial_client_logger_LoggerFactory$.getLogger__T__Lspatutorial_client_logger_Logger (LoggerFactory.scala:42)
at $c_Lspatutorial_client_logger_package$.init___ (package.scala:4)
at $m_Lspatutorial_client_logger_package$ (package.scala:3)
at $c_Lspatutorial_client_SPAMain$.main__V (SPAMain.scala:58)
at client-fastopt.js:68923
at client-fastopt.js:68924
paths-scala-js
is a Scala.js library, not a JS library, so you need to add it with libraryDependencies
not scalajsDependencies
Hi, @ochrons ; Could You help, I update my sbt from 0.3.15 to 1.1.1, because is getting my machine slow, so in the build.sbt line 88, is this:
// loads the Play server project at sbt startup
onLoad in Global := (Command.process("project server", _: State)) compose (onLoad in Global).value
build.sbt:88: error: value process is not a member of object sbt.Command
onLoad in Global := (Command.process("project server", _: State)) compose (onLoad in Global).value
[info] p.a.h.EnabledFilters - Enabled Filters (see <https://www.playframework.com/documentation/latest/Filters>):
play.filters.csrf.CSRFFilter
play.filters.headers.SecurityHeadersFilter
play.filters.hosts.AllowedHostsFilter
[info] play.api.Play - Application started (Dev)
[warn] p.filters.CSRF - [CSRF] Check failed because application/json for request /logging
[warn] p.filters.CSRF - [CSRF] Check failed because application/octet-stream for request /api/spatutorial/shared/Api/getAllTodos
[warn] p.filters.CSRF - [CSRF] Check failed because application/octet-stream for request /api/spatutorial/shared/Api/welcomeMsg
[warn] p.filters.CSRF - [CSRF] Check failed because application/octet-stream for request /api/spatutorial/shared/Api/welcomeMsg
i can't figure out the magic in these lines:
class MotdHandler[M](modelRW: ModelRW[M, Pot[String]]) extends ActionHandler(modelRW) {
…
case action: UpdateMotd ⇒
val updateF = action.effect(AjaxClient[Api].welcomeMsg("User X").call())(identity _)
action.handleWith(this, updateF)(PotAction.handler())
I wanted to put more things on the main page (e.g. a second string that can refresh like the motd), so I changed the ModelRW[M, Pot[String]]
to ModelRW[M, Dashboard]
, with:
case class Dashboard(motd: Pot[String], otherMsg: Pot[String])
and can't figure out how to modify those Handler lines to update just Dashboard.motd
I thought proxy().render
/ the Ready
state should be set to pending when I start fetching a new value from the server via a handler with
action.handleWith(this, updateF)(PotAction.handler())
but i'm seeing the previous render
value persisting through pending
and failed
states of the subsequent value. :confused: :mag_right:
sorry, not a fully formed question yet
Effect
that explictly sets the value to "pending", and then another that requests the new value from the server? it seems like the proxy().renderPending (_ > 100, …)
bits correctly display a "Loading..." message, they just don't wipe the previous value,
proxy().render
to proxy().renderReady
makes those different render-calls mut-exc. cool!
where can i put a 3rd-party .js
file for the build to copy it into the public
folder so that i can serve it like a static asset?
seems like normally it would go in public/
in the root of the project, but my guess is that .disablePlugins(PlayLayoutPlugin)
on the server
module disrupts that?
I'm trying a bunch of other setups but haven't found one that works yet
unmanagedResourceDirectories in Assets += baseDirectory.value / "public"