Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 27 19:58
    scala-steward closed #460
  • Feb 27 19:58
    scala-steward commented #460
  • Feb 27 19:58
    scala-steward opened #467
  • Feb 27 01:14
    scala-steward opened #466
  • Feb 27 01:14
    scala-steward opened #465
  • Feb 14 21:35
    scala-steward synchronize #451
  • Feb 14 20:53

    shadaj on master

    Update sbt-sonatype to 3.9.5 (#… (compare)

  • Feb 14 20:53
    shadaj closed #435
  • Feb 14 20:53

    shadaj on master

    Update sbt to 1.4.7 (#462) (compare)

  • Feb 14 20:53
    shadaj closed #462
  • Feb 12 12:10
    scala-steward closed #442
  • Feb 12 12:10
    scala-steward commented #442
  • Feb 12 12:10
    scala-steward opened #464
  • Feb 04 06:45

    shadaj on v0.6.7

    (compare)

  • Feb 04 01:54

    shadaj on master

    Release v0.6.7 (compare)

  • Feb 02 22:32
    scala-steward opened #463
  • Jan 31 07:43
    scala-steward opened #462
  • Jan 28 07:49
    sidnt opened #461
  • Jan 15 19:35

    shadaj on master

    Add dependency on Java IntelliJ… (compare)

  • Jan 15 17:44
    scala-steward closed #450
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 :(
Øyvind Raddum Berg
@oyvindberg
@peterstorm my guess is that the slinky dom dsl has declared that aria attributes are not valid for svg elements, this is done through implicits. Check the companion object of the svg you're using, you can copy/paste and customize one of the implicits to explicitly allow it in your code
Peter Storm
@peterstorm
Uh, I have no idea how to do that :(
Maybe it's because it uses the wrong operator? Its overloaded and can come from different places
But an AttrPair extends a TagMod
Peter Storm
@peterstorm
I figured it out by mistake! ?D
I was using the wrong aria
but then I did a role and it prefixed it all with slinky.web.svg and I thought, maybe there's an aria one for that
And there was! :D
Peter Storm
@peterstorm
Oh, but there's not data tag in there, damn :(
Peter Storm
@peterstorm
I'm trying to pass a component as props to another component, like so:
image.png
But the compiler says value apply is not a member of slinky.core.facade.ReactElement
The react annotation
Peter Storm
@peterstorm
Well, i guess that doesnt work. How would i pass a component as props then?
Alexis Hernandez
@AlexITC
that's the way to pass the component, I even have something similar (see), sometimes the macro highlights errors but sbt compiles fine
Peter Storm
@peterstorm
@AlexITC Can you point me to where you use that componenet, and pass another component to it? Can't seem to find that :D
1 reply