Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 15 19:35

    shadaj on master

    Add dependency on Java IntelliJ… (compare)

  • Jan 15 17:44
    scala-steward closed #450
  • Jan 15 17:44
    scala-steward commented #450
  • Jan 15 17:44
    scala-steward opened #460
  • Jan 14 22:12

    shadaj on master

    Add Java IntelliJ plugin as a d… (compare)

  • Jan 11 22:06
    scala-steward opened #459
  • Jan 11 19:06

    shadaj on master

    Increase detail of IntelliJ plu… (compare)

  • Jan 11 19:05

    shadaj on master

    Update sbt to 1.4.6 (#457) (compare)

  • Jan 11 19:05
    shadaj closed #457
  • Jan 10 04:37

    shadaj on master

    Update IntelliJ plugin vendor w… (compare)

  • Jan 06 17:48

    shadaj on master

    Adjust IntelliJ plugin name bas… (compare)

  • Jan 06 01:09

    shadaj on master

    Package IntelliJ plugin twice t… (compare)

  • Jan 06 00:27

    shadaj on master

    Fix version of IntelliJ SDK tha… (compare)

  • Jan 06 00:12

    shadaj on master

    Add missing until-build propert… (compare)

  • Jan 05 22:22

    shadaj on master

    Add IntelliJ plugin repo token … (compare)

  • Jan 05 21:33

    shadaj on master

    Set up IntelliJ support to be p… (compare)

  • Jan 05 21:33
    shadaj closed #458
  • Jan 05 20:35
    shadaj edited #458
  • Jan 05 20:34
    shadaj opened #458
  • Jan 05 20:34

    shadaj on intellij-standalone-plugin

    Set up IntelliJ support to be p… (compare)

mcallisto
@mcallisto

Took me some time to figure this out but works great

@joan38 thank you! I have been helped to find a somehow simpler solution, identifying the correct relative dir (in relation to target). I will add it to a demo and post here the details.

mn98
@mn98
@shadaj @joan38 I've been using Play+Slinky so I'm curious to understand how you do all the routing/json/sse/streaming between the client and server with just Slinky. Or have I misunderstood and there is no jvm 'server' in this case?
I'm quite new to JS app dev generally so please feel free to spell out the obvious to me!
Ramnivas Laddad
@ramnivas
@mn98 We don't use Play, but based on our experience, routing will be handled in client (we use React Router). In our case, the server (written in Scala) simply provides the API (a mix of REST and GraphQL); the client is otherwise disconnected from the server implementation.
mn98
@mn98
@ramnivas thanks very much, I shall do some homework!
František Kocun
@fokot
@mn98 or you can use https://github.com/lihaoyi/autowire if you want to call scala function in code which in reality will be call to server
Pascal Mengelt
@pme123
I was wondering if there is an example with the following 'features':
  • sbt multi-modules (server / client / shared)
  • using a CSS library like Semantic-UI
  • using REST-APIs and Websockets
    Examples or Projects that use parts of my list are of course also welcome;).
2 replies
Gabor Juhasz
@gjuhasz86
hi, is there a way to create a component that has a generic type parameter?
@react class MyComponent[T] extends Component { ... }
Pascal Mengelt
@pme123

small bug in documentation ( https://slinky.dev/docs/the-tag-api/ )?

input(onChange := (event) => {
  println("the value of this input element was changed!")
})

does not work - this works:

input(onChange := (event => {
        println(s"the value of this input element was changed!")
      }))

Only difference are the parentheses.

Peter Storm
@peterstorm
Can we use Webworkers in Slinky?
Ramnivas Laddad
@ramnivas
Yes, you may.
Gabor Juhasz
@gjuhasz86
hi, is there anything special needed to get onKeyPress working? Looks like it never gets called.
https://scalafiddle.io/sf/qJcjX5e/18 (couldn't make it work locally either)
Ramnivas Laddad
@ramnivas

If you change your element to input, it works fine (unless the element has focus, it won't receive any key events):

      input(
        onClick:= (_ => println(s"MOUSE")),
        onKeyPress:= (_ => println(s"KEYBOARD"))
      )

Also, onKeyPress is deprecated (but works), so you should be using onKeyDown (https://developer.mozilla.org/en-US/docs/Web/API/Document/keypress_event)

Gabor Juhasz
@gjuhasz86
Thanks, although it looks like even input only fires the keyPress/keyDown events when it is focused. That's not really feasible for my use case.
Pascal Mengelt
@pme123
image.png
Hi, I write a blog, translating the intro tutorial of react to Slinky. Before I publish it, I thought to get some feedback from Slinky cracks;).
Alexis Hernandez
@AlexITC

Is there any example for functional components depending on generic types? apparently, def component[D] = FuncionalComponent[Props[D]] {...} is not enough

@react must annotate:
[error]   - a class that extends (Stateless)Component,
[error]   - an object that extends ExternalComponent(WithAttributes)(WithRefType)
[error]   - an object defining a `val component = FunctionalComponent(...)`
[error]   @react class RemoteDataLoaderComponent {

I have tried some variations without luck

Alexis Hernandez
@AlexITC
correction, my only approach until now is defining a base trait that uses the generic type, requiring to extend such component every time, I'd like to get to use functions only:
trait RemoteDataLoaderBase[D] {
  case class Props(fetcher: () => Future[D], render: D => ReactElement)

  val theComponent: FunctionalComponent[Props] = FunctionalComponent[Props] { ...}
}

@react object MyProductsSummaryLoader extends RemoteDataLoaderBase[GetTrackedProductsResponse] {
  val component = theComponent
}
Alexis Hernandez
@AlexITC
Another question, I'm struggling to force a refresh for the whole component, given react-faq, something as simple as this custom hook should be enough, but for some reason, it isn't, I have added debug logs, and the counter gets updated properly but the component isn't rendered again as expected:
  def forceRefresh() = {
    val (_, increment) = Hooks.useReducer[Int, Int](_ + _, 0)
    () => increment(1)
  }
Alexis Hernandez
@AlexITC
thanks, it's basically the same as what I posted, I think my problem relates to a component that uses the Hooks.setEffect(..., ""), which prevents the effect from running multiple times, unfortunately, I have no idea how to force such effect to run again without getting in executed indefinitely
Shadaj Laddad
@shadaj
@pme123 just took a look at your blog post, and it looks great! It's awesome to see how easy it was to port some JavaScript code to Scala.js with Slinky!
Alexis Hernandez
@AlexITC

Anyway, I ended up writing this: https://github.com/wiringbits/cazadescuentos/blob/master/lib/ui/src/main/scala/net/wiringbits/cazadescuentos/ui/components/RemoteDataLoaderBase.scala

I'm not 100% happy with the solution but it works, thanks for the help

Pascal Mengelt
@pme123
@shadaj yeah really great work you and the Slinky community did -keep up the excellent work:). By the way I saw that the link not works anymore - here is the published one:
https://pme123.medium.com/slinky-doing-react-the-scala-way-f78ccf42bf8f
Peter Storm
@peterstorm
Is there anything wrong with just depending on a CSS framework by getting it in the index.html file, and then just adding classes in the code?
Peter Storm
@peterstorm
Im trying to use the ScalablyTyped plugin for typescript types, but it hangs on trying to build the standard library or something?
Phase3Compile.scala:125 Building C:\Users\phn.ivy2\local\org.scalablytyped\std_sjs1_2.13\4.0-34aa7a\jars\std_sjs1_2.13.jar... [thread => 177, project => conn...
Anyone have experience with that? It's been going for ages and complains about spending too much time garbarge collecting
Im using sbt
Alexis Hernandez
@AlexITC
You need to increase the memory, latest versions need a lot, this worked for me, create .sbtopts with
-J-Xmx4G
-J-XX:MaxMetaspaceSize=4G
-J-XX:+CMSClassUnloadingEnabled
Peter Storm
@peterstorm
Thanks that worked!
Pascal Mengelt
@pme123
Is there an example on how to integrate JavaScript code that is not a React Component? According to the doc are External Components just for them.
I have the following I want to use with Slinky. Using External Components did not work.
import Modeler from 'bpmn-js/lib/Modeler';

const modeler = new Modeler({
  container: $modelerContainer,
  moddleExtensions: {
    custom: customModdleExtension
  },
  keyboard: {
    bindTo: document.body
  }
});
nafg
@nafg
@pme123 just refer to regular scala.js docs
Peter Storm
@peterstorm
Is it possible to import an scss file and use the classes defined in that?
Peter Storm
@peterstorm
Is it just like example app, where you just import it as an js object, and make the styles available via a private val?
Peter Storm
@peterstorm
And how do I do an aria-hidden, I can see there's a WithDash class, but I'm unsure of the syntax
Peter Storm
@peterstorm
Ah it was in the docs
But I get this error when I try to do it to an svg tag: type mismatch; found : slinky.core.AttrPair[slinky.web.html._aria_attr.type] required: slinky.core.TagMod[slinky.web.svg.svg.tag.type]
Peter Storm
@peterstorm
Hmm does sass loading even work in scala JS / slinky?
Peter Storm
@peterstorm
Ok, figured out the sass part, but still dont understand the type mismatch above
Mardo Del Cid
@mardo
Hi Guys, I think 0.6.6 doesn’t come with IntelliJ support. I’m testing on IntelliJ 2020.2.3. 0.6.5 works for me though.
Peter Storm
@peterstorm
image.png
No one able to help with this please?
Error is this: type mismatch; found : slinky.core.AttrPair[slinky.web.html._aria_attr.type] required: slinky.core.TagMod[slinky.web.svg.svg.tag.type]
nafg
@nafg
Just a guess, are you missing an import?
scalajs-react has similar types and it relies on an implicit, which means you need a certain import
Peter Storm
@peterstorm
Maybe? :D Which one would that be?
nafg
@nafg
dunno, look at some example project source files
Peter Storm
@peterstorm
Yeah, there's not a lot of that going around :(