Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 13 10:51
    scala-steward closed #542
  • May 13 10:51
    scala-steward commented #542
  • May 13 10:51
    scala-steward opened #570
  • May 11 00:19
    evelant opened #569
  • May 10 13:53
    evbo commented #196
  • Apr 30 22:02
    shadaj demilestoned #240
  • Apr 30 22:00
    shadaj milestoned #537
  • Apr 30 22:00
    shadaj labeled #537
  • Apr 30 22:00
    shadaj commented #537
  • Apr 30 21:58
    shadaj commented #566
  • Apr 30 21:58
    shadaj milestoned #566
  • Apr 30 21:58
    shadaj labeled #566
  • Apr 30 21:57
    shadaj commented #566
  • Apr 30 21:56
    shadaj demilestoned #568
  • Apr 30 21:56
    shadaj milestoned #568
  • Apr 30 21:55
    shadaj milestoned #568
  • Apr 30 21:55
    shadaj labeled #568
  • Apr 27 18:45
    evbo opened #568
  • Apr 27 17:43
    evbo commented #556
  • Apr 25 20:16
    scala-steward closed #550
Alexander Samsig
@asamsig:matrix.org
[m]

The point about IntelliJ is mostly to show that Scala 3 isn't fully mainstream yet, if not even IntelliJ has seamless support yet.

I'm not the guy for lightweight IDEs, I'm way too accustomed to the benefits of a fullblown IDE.

Scala 3 will get there, but Scala 2 is not in its grave yet.

asaadza
@asaadza
... don't worry, scala 2 will be around for ages. Try ,metals, you'll be amazed. I love IJ, but metals has now ahead in some areas. The only thing I miss from IJ is probably "search for symbol everywhere" (metals finds types, but not members).
2 replies
shadaj
@shadaj:matrix.org
[m]
Yeah, I think full Scala 3 support will take a while since many metaprogramming features that Slinky uses aren't there yet. However, I'd be open to merging in preliminary Scala 3 support without @react if that's something people would use!
asaadza
@asaadza
@shadaj:matrix.org +1
Alexis Hernandez
@AlexITC

I'd be open to merging in preliminary Scala 3 support without @react if that's something people would use!

My team will happily use it that way

Myyk Seok
@myyk
I was just doing a toy project, but I too would have enjoyed the preliminary Scala 3 support
asaadza
@asaadza
@shadaj:matrix.org another not so obvious, but in my opinion very valuable benefit of releasing a "preliminary Scala 3 support without @react" Slinky is that people who have the imagination and skill will have a good base/foundation (ie the build and all the MDN based code generation/type projections/named params etc already working and proven) to try out alternatives/different ideas on for the apply problem (which would probably be sufficient for those who prefer functional components anyway) so slinky react UI development is still the nicest and most intuitive UX in scalajs land.
Ryne Flood
@ryne.flood_gitlab
@shadaj:matrix.org +1
Arman Bilge
@armanbilge
@shadaj:matrix.org would you mind approving the workflow on my PR? Thanks in advance!
zoombinis
@zoombinis

I'm not sure if this is a bug with Slinky reader, but I am using Reader[MyClass] when calling a facade that returns a JSON object in order to deserialize it into MyClass

It tricks the scala compiler into assuming the type of the result is MyClass but unfortunately Option[String] types are actually just String causing runtime exceptions

Is there a way to get a Reader to honor Option types? MyClass has an attribute that is Option[String], so could Reader[MyClass] return Some("text") instead of just "text"?

zoombinis
@zoombinis

Oh, I think I know the answer - because MyClass isn't a case class Props to some @React object, Slinky can only work with plain js.Object types. So I need to use js.UndefOr instead of Option

Yup, that was it!

Jason Pickens
@steinybot:matrix.org
[m]

I've got a question about Reader. I'm trying to create a Reader[NoYes] for:

final case class NoYes(value: Option[Boolean], onChange: Boolean => Unit)

And it blows up in slinky.readwrite.FunctionReaders#function1 when the component tries to call onChange saying fn is not a function. It's not a function because fn is undefined. It wasn't entirely clear where fn was coming from, it seemed to be part of the anonymous function.
Stepping through the JS code, the Reader[NoYes] was trying to read o.value and o.onChange instead of the actual properties which is some long fully qualified name with . replaced with _. Presumably this is the Reader macro doing this? I've never had a problem before. Any idea why this one is different?

shadaj
@shadaj:matrix.org
[m]
Hmm, not sure I completely understand what's going on Jason Pickens. Readers expect the JS object being red to have attributes corresponding to the names in the case class, so calling .onChange on the read value corresponds to calling .onChange on the original value.
Jason Pickens
@steinybot:matrix.org
[m]
The problem was related to using ReactComponentClass. Turns out I didn't need this (I accidentally used React.memo from ST and not the Slinky one).
zetashift
@sp33der89:matrix.org
[m]
I see preliminary Scala 3 support has landed, has anyone been playing around with it/ has some code examples?
evbo
@evbo

@shadaj:matrix.org with Slinky being such a great advent, have you (un)seriously considered a Svelte companion-repo to Slinky?: https://svelte.dev/

Looks awesome but I'm too invested in React, unless the tides were to change (some day)...

shadaj
@shadaj:matrix.org
[m]

zetashift: mostly, the API is identical except for not having the @react macro available, so you'll have to manually use ComponentWrapper for class components and create a nicer apply yourself

but other than that, we actually share all the unit test code between Scala 2 and 3 so things are actually mostly source compatible too

@evbo: svelte would be interesting to explore someday! one challenging thing is that svelte has a much more opinionated file structure and build tool that might be hard to make compatible with how Scala.js spits out its JS files, but still definitely something worth exploring
Alexis Hernandez
@AlexITC
Are there any short-term plans to release slinky with https://github.com/scala-js/scala-js-dom/releases/tag/v2.0.0? this is blocking me from including https://github.com/scala-js/scala-js-macrotask-executor in several projects
shadaj
@shadaj:matrix.org
[m]
this week! sorry for the delay
going to try to squeeze in some React 17 features (since this will be a bump to 0.7.0), but will release one way or another
or actually, lemme see if there are any source compatibility issues; if not could be a minor version since we've been following semver >> 1
Alexis Hernandez
@AlexITC

@shadaj:matrix.org do you have any plans to allow propagating implicits from components? from what I see, there is a big deal when declaring a component by using def instead of val, which is what prevent this approach to work.

I understand that doing this would break exporting components to js but it would be pretty useful to propagate context in a type-safe way

shadaj
@shadaj:matrix.org
[m]
@AlexITC: probably not in the short term, we try to avoid introducing features that would break patterns in regular React code so that new developers don't have to learn a different way of writing their apps
nafg
@nafg
What does the home page mean by
Slinky comes ready with full integration with familiar tools like [...] React DevTools.
For instance with scalajs-react props and state that are scala objects are very hard to understand in react dev tools
Does Slinky do something special to improve on this?
Fabio Epifani
@epifab
:wave: is Slinky ready for Scala 3? I've noticed the annotation package is missing...
Alexis Hernandez
@AlexITC
Slinky 0.7.0 supports scala 3, the drawback is that the @react macro won't work
Fabio Epifani
@epifab
I am new to Slinky, is there an example of defining components without those annotations?
shadaj
@shadaj:matrix.org
[m]
@epifab: take a look at the component styles section of https://slinky.dev/docs/writing-components/
the macro annotation was designed to not do too much magic, so it just compiles down to the regular API
@nafg: yep, that's exactly one of the things we do; in dev mode the Scala components use reader/writer pairs to make the states easier to view in the devtools
Fabio Epifani
@epifab
@shadaj:matrix.org thanks. is there an equivalent for ExternalComponentWithRefType?
shadaj
@shadaj:matrix.org
[m]
@epifab: you can just use that in Scala 3! The @react annotation on external components only adds the nice apply method, but doesn't do any other rearranging.
Fabio Epifani
@epifab
ah great. thank you!
the problem I have now though is method deriveWriter in trait MacroWriters does not match type slinky.readwrite.Writer[Props]
Fabio Epifani
@epifab
hmm strange, it seems to work if the props case class includes up to 27 properties. with 28 properties it throws method summonAll is declared as erased, but is in fact used
and from 29 properties the errors I mentioned before
feels like a bug
Fabio Epifani
@epifab
nafg
@nafg
@shadaj:matrix.org meaning that the objects passed to react under the hood are not the user's Scala object but a serialization of it?
shadaj
@shadaj:matrix.org
[m]
Yeah, only for supported types in dev mode with hot-reloading enabled however. If you use a custom unknown type Slinky will just pass it through as-is.
jmaamo
@jmaamo
Hi There! I'm doing some research on react/scala-js that somehow lead me to slinky. With my limited experience, I was wondering how routing is best implemented in slinky. Thanks for the help.
Alexis Hernandez
@AlexITC
@jmaamo react-router-dom is the way I have saw more frequently, be sure to check these:
jmaamo
@jmaamo
Thanks, @AlexITC - i'll definitely check these out.
jmaamo
@jmaamo
@AlexITC/@shadaj:matrix.org - I just want to let you all know that I'm progressing well in my research work. So far, I'm extremely happy with what I learned. I believe what you guys are doing are phenomenal !!!
Jason Pickens
@steinybot
Is there a way to improve errors like this:
...
react-dom.development.js:12657 The above error occurred in the <Component> component:

    at eval (webpack:///./target/scala-2.13/client-fastopt/slinky.core.FunctionalComponent.js?:77:59)
    at eval (webpack:///./target/scala-2.13/client-fastopt/slinky.core.FunctionalComponent.js?:77:59)
    at eval (webpack:///./target/scala-2.13/client-fastopt/slinky.core.FunctionalComponent.js?:77:59)
    at eval (webpack:///./target/scala-2.13/client-fastopt/slinky.core.FunctionalComponent.js?:77:59)