Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 06:13
    Katrix opened #333
  • 03:40
    Katrix commented #332
  • 03:39
    shadaj labeled #331
  • 03:39
    shadaj milestoned #331
  • 03:39
    shadaj commented #332
  • 02:53
    ryneflood commented #331
  • 02:52
    Katrix opened #332
  • 02:49
    Katrix opened #331
  • Feb 25 00:59

    shadaj on v0.6.4

    (compare)

  • Feb 24 19:50

    shadaj on master

    Release v0.6.4 (compare)

  • Feb 24 19:45
    shadaj milestoned #279
  • Feb 24 19:44
    shadaj milestoned #311
  • Feb 24 19:44
    shadaj demilestoned #311
  • Feb 24 19:44
    shadaj demilestoned #304
  • Feb 24 19:44
    shadaj milestoned #304
  • Feb 22 18:09

    shadaj on master

    Bust README badge cache with a … (compare)

  • Feb 21 20:48
    joan38 opened #330
  • Feb 21 18:39

    shadaj on master

    Update CHANGELOG.md to reflect … (compare)

  • Feb 21 18:39
    shadaj closed #329
  • Feb 21 18:39
    shadaj commented #329
Shadaj Laddad
@shadaj
@trepidacious yep! the Expo server should be watching that file
SWAPNIL SONAWANE
@iamswapnil44_twitter

Hi All, Is there any way to redirect to another page once button get clicked. I am doing it by adding Route in onclick even but redirecting does not happened. example :

button(className := "btn btn-primary",
          onClick := (_ => {
            Route(RouteProps(path = "/refresh", render = props => RefreshPage(props)))
          }))("Submit Job")

is there any other way to fix it ?

Shadaj Laddad
@shadaj
@iamswapnil44_twitter so in React, onClick handlers do not return anything since they are just general callbacks; what you'll need to do is store some state, update that state in the handler, and use that state to determine whether or not to render that route
SWAPNIL SONAWANE
@iamswapnil44_twitter

as per your suggestion this is how i have done but still no luck :

val (state, updateState) = useState(0 )
button(className := "btn btn-primary",
          onClick := (_ => {
            updateState(state + 1)
            if (state > 0 )
              Route(RouteProps(path = "/refresh", render = props => RefreshPage(props))),
          }))("Submit")

am i missing something here ?

Ramnivas Laddad
@ramnivas
calling updateState won't take effect immediately (state is updated asynchronously).
You need to use an useEffect (with a dependency on state and do your route change there. Please take a look at React's documentation around useEffect, since then you can translate it directly to Slinky.
Joan Goyeau
@joan38

Hi,

<TextField {...params} label="Combo box" variant="outlined" fullWidth /

Any chance to do something like this {...params} to a component?

Joan Goyeau
@joan38
Another question:
Is it possible to use Typed Props with External Component?
Shadaj Laddad
@shadaj
@joan38 as of now there's not a great solution for that since Scala doesn't support the equivalent concept with case classes. For typed props, it is possible but doesn't work with the @react annotation right now. You'll need to define a props type without the type parameters and change the apply to take them as in https://github.com/shadaj/slinky/blob/master/native/src/main/scala/slinky/native/FlatList.scala. Not a super great solution though, will need to think how we could handle this better
trepidacious
@trepidacious
@shadaj I had a play around with the expo reloading - if I enable hot reloading then I do get an update when changing code and running fastOptJS. Weirdly, if I use Live Reload instead, I get an update on fastOptJS, but always to the previous version, so if I change text to "1" and rebuild, then "2" and rebuild, I'll see "1" in the app. If I trigger a manual reload I see "2".
Shadaj Laddad
@shadaj
@trepidacious hot reload is the option you generally want to use, live reload works by just resetting the app state. Any particular reason you wanted to use the latter?
Shadaj Laddad
@shadaj
@/all Slinky 0.6.4 has been released, featuring support for Scala.js 1.0.0, new modules for interacting with React Router, some API cleanups, and more! Thanks to all the contributors who made this release one of the biggest we've had! Full changelog at https://github.com/shadaj/slinky/blob/master/CHANGELOG.md#v064 and detailed diff at https://github.com/shadaj/slinky/compare/v0.6.3...v0.6.4.
Øyvind Raddum Berg
@oyvindberg
:balloon:
Martynas Mickevičius
@2m
:fireworks:
Zak Patterson
@zakpatterson
woo!
ryneflood
@ryneflood
hey all, so trying to use the newest release (0.6.4) with ScalaJS 1.0.0 and it doesn't seem to want to work, I get the following error complaining about using a file that was compiled for a previous version of Scala.js:
[info] Fast optimizing /home/ryne/workspace/@rocketpants/dookie-frontend/web/target/scala-2.13/scalajs-bundler/main/dookie-web-fastopt.js [error] stack trace is suppressed; run last web / Compile / fastOptJS for the full output [error] stack trace is suppressed; run last web / Compile / npmInstallJSResources for the full output [error] (web / Compile / fastOptJS) org.scalajs.ir.IRVersionNotSupportedException: Failed to deserialize a file compiled with Scala.js 1.0-RC1 (supported up to: 1.0): org/scalajs/linker/runtime/RuntimeLong.sjsir [error] You may need to upgrade the Scala.js sbt plugin to version 1.0-RC1 or later. [error] (web / Compile / npmInstallJSResources) java.nio.file.NoSuchFileException: /home/ryne/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.1/scala-compiler-2.13.1.jar:jquery.min.js [error] Total time: 1 s, completed Feb 25, 2020 7:02:45 PM
tried cleaning everything I could thing of, and even trying a fresh project just to check if that was the issue, but still get that error
any ideas? (Let me know if more information would help here). I'm using slinky-web and slinky-hot @ v0.6.4, scala.js @ v1.0.0 and sbt-scalajs-bundler @ v0.16.0
appreciate any help! thanks
oh, btw, compiling runs fine, it's only when I run dev within sbt to trigger fastOptJS that it fails!
and I've even tried killing the /home/ryne/.cache/coursier directory mentioned in the error message so that everything gets fetched again, still no dice
Shadaj Laddad
@shadaj
@ryneflood hmm that's very odd, especially since the failing file is one from the Scala.js libraries, not from Slinky; could you try running dependencyClasspath to check which JARs are being used?
oh, also, you should be using scalajs-bundler version 0.17.0, which uses Scala.js 1.0 instead of an RC. My guess is that's the cause of the issue since the plugin is probably adding old RC JARs to the classpath
Zhange
@zhan-ge
Hi, Is there a office-ui-fabric-react wrapper and some usage demos?
ryneflood
@ryneflood
@shadaj assuming you mean sbt dependencyClasspath (I think that's the one!) here's the output: doesn't seem like anything too interesting so I may not be doing it properly
▶ sbt dependencyClasspath [info] Loading global plugins from /home/ryne/.sbt/1.0/plugins [info] Loading settings for project dookie-frontend-build from plugins.sbt ... [info] Loading project definition from /home/ryne/workspace/@rocketpants/dookie-frontend/project [info] Loading settings for project root from build.sbt ... [info] Loading settings for project apolloScalajsReact from build.sbt ... [info] Loading settings for project apolloScalajsCore from build.sbt ... [info] Loading settings for project slinkyStyledComponents from build.sbt,publish.sbt ... [info] Set current project to root (in build file:/home/ryne/workspace/@rocketpants/dookie-frontend/) [success] Total time: 0 s, completed Feb 26, 2020 11:15:56 AM
p.s. I have dependencies on slinkyStyledComponents, apoloScalajsCore and apolloScalajsReact projects but nothing seems to change if I remove those
ryneflood
@ryneflood
ok, so upgrading to scalajs-bundler @ v0.17.0 gets me further (didn't realize there was any version > 0.16.0!)
now I get:
info] Starting webpack-dev-server [success] Total time: 7 s, completed Feb 26, 2020 11:41:26 AM [success] Total time: 0 s, completed Feb 26, 2020 11:41:26 AM [info] 1. Monitoring source files for root/web/fastOptJS... [info] Press <enter> to interrupt or '?' for more options. [error] internal/modules/cjs/loader.js:573 [error] throw err; [error] ^ [error] Error: Cannot find module 'webpack-cli/bin/config-yargs' [error] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15) [error] at Function.Module._load (internal/modules/cjs/loader.js:497:25) [error] at Module.require (internal/modules/cjs/loader.js:626:17) [error] at require (internal/modules/cjs/helpers.js:20:18) [error] at Object.<anonymous> (/home/ryne/workspace/@rocketpants/dookie-frontend/web/target/scala-2.13/scalajs-bundler/main/node_modules/webpack-dev-server/bin/webpack-dev-server.js:77:1) [error] at Module._compile (internal/modules/cjs/loader.js:678:30) [error] at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10) [error] at Module.load (internal/modules/cjs/loader.js:589:32) [error] at tryModuleLoad (internal/modules/cjs/loader.js:528:12) [error] at Function.Module._load (internal/modules/cjs/loader.js:520:3)
p.s. sorry about the formatting; Gitter doesn't seem to like the line breaks when I copy and paste
ryneflood
@ryneflood
ok, so the above error just turned out to be an old version of webpack-dev-server. I updated webpack to v4.41.6 and webpack-dev-server to v3.10.3 and the dev command runs fine now
There's an error when I actually try to load the project in a browser now, but I'll investigate that one later. Thanks!
ryneflood
@ryneflood
ok so just had a quick chance to look at the error in-browser. It's due to HMR: if i remove slinky-hot / the call to hot.initialize() in Main.scala everything works fine
of course, I wouldn't mind having HMR working :) So the error is:
package.scala:10 Uncaught ReferenceError: proxies is not defined at $c_Lslinky_hot_package$.initialize__V (package.scala:10) at $c_Lca_rocketpants_dookie_Main$.main__V (Main.scala:44) at Object.eval [as main] (Main.scala:42) at eval (scalajs-entry.js:11) at Object../scalajs-entry.js (dookie-web-fastopt.js:9066) at __webpack_require__ (dookie-web-fastopt.js:726) at fn (dookie-web-fastopt.js:101) at Object.0 (dookie-web-fastopt.js:9079) at __webpack_require__ (dookie-web-fastopt.js:726) at dookie-web-fastopt.js:793
which then eventually leads me to:
package object hot { def initialize(): Unit = { if (js.isUndefined(js.Dynamic.global.proxies)) { js.Dynamic.global.proxies = js.Dynamic.literal() }
again, sorry for the lack of line breaks...(let me know how to make Gitter respect the line breaks when copy-and-pasting)
any ideas where I'd start to look to fix that last error?
Øyvind Raddum Berg
@oyvindberg
also you can use triple backticks like in markdown for code
ryneflood
@ryneflood
also you can use triple backticks like in markdown for code
thanks but I have been wrapping them in triple backticks! It really doesn't seem to respect my line breaks
@oyvindberg ok thanks for the heads-up. Any recommendations on what to try for a fix? Not a huge deal if I don't have HMR, but ya know, it'd be nice!
ryneflood
@ryneflood
@oyvindberg you're right; that seems to be the source of the error. Just removing the js.isUndefined check makes it work. Probably not an actual solution, but gets it working in my case
thanks
Shadaj Laddad
@shadaj
@ryneflood that's a good catch, forgot to test with hot-reloading! we can probably place the proxies variable on js.Dynamic.global.window, or better yet when in Scala.js 1.0 mode we can use js.Dynamic.global.module since that will directly resolve to the Node.js module variable.
ryneflood
@ryneflood
@shadaj :+1: