Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 10:57
  • Jan 30 2019 22:22
    bitpirate starred japgolly/scalajs-react
  • Jan 30 2019 08:11

    japgolly on master

    Update docs for changes in 1.4.0 (compare)

  • Jan 29 2019 13:20
  • Jan 28 2019 08:08
    booleguo starred japgolly/scalajs-react
  • Jan 28 2019 04:09

    japgolly on v1.4.0

    (compare)

  • Jan 28 2019 04:05

    japgolly on master

    Towards v1.4.1 (compare)

  • Jan 28 2019 04:04

    japgolly on master

    Prepare for v1.4.0 Upgrade React to 16.6.3 React.lazy and 85 more (compare)

  • Jan 28 2019 04:04
    japgolly closed #521
  • Jan 28 2019 04:04
    japgolly opened #521
  • Jan 28 2019 04:03

    japgolly on v1.4.x

    Add note about Reusability/Reus… doc formatting Prepare to release v1.4.0 (compare)

  • Jan 28 2019 04:02
    wiitht starred japgolly/scalajs-react
  • Jan 28 2019 03:18

    japgolly on v1.4.x

    Test AsyncCallback.init Update Travis CI caching (compare)

  • Jan 28 2019 03:02

    japgolly on v1.4.x

    Update Travis CI cache dirs Revise changelog (compare)

  • Jan 28 2019 03:00
    japgolly labeled #520
  • Jan 28 2019 03:00
    japgolly labeled #519
  • Jan 27 2019 17:36
  • Jan 26 2019 06:49
    japgolly commented #520
  • Jan 26 2019 05:55
    japgolly commented #519
  • Jan 26 2019 02:35
    cquiroz opened #520
David Barri
@japgolly
Oh wow, what funny timing this is for me to check in here :D
David Barri
@japgolly
@nafg is right. My habit when in front of a computer is to spend about 5-10 reading reddit or whatever, then it's just full-steam-ahead coding non-stop. I find the burden of having to reply to github, email, and twitter sometimes more than enough so it's extremely rare that I go out looking for more spaces to reply / chat / talk. I'm just a work machine. So yeah sorry @arminio, I hope there's enough knowledge around people here that everyone can help everyone out. Otherwise feel free to raise a StackOverflow question or Github issue if no one knows, I'll try to make time to respond but there might be a wait because I've literally got months and months worth of work already queued up.
David Barri
@japgolly
@arminio To answer the question about Sack though, it's pretty funny that you're peeking around there. I'm gonna guess that you inspected a type and the IDE dealiased the type for you. As you can see from the subtypes, a Sackis a value, a recursive product or a recursive coproduct. @nafg made an educated guess that it's related to typeclass derivation but it's actually the structure of all composable concepts in Test State. Users are not supposed to know about it because it's part of the internal API and you never interact with it directly. The public types that you should know about are documented here https://github.com/japgolly/test-state/blob/master/doc/TYPES.md and under-the-hood, some of them dealias to Sacks. If you want to be explicit about your Test State types, use the type members provided on your dsl object. This is an example: https://github.com/japgolly/test-state/blob/master/example-react/src/test/scala/teststate/example/react/TodoTestDsl.scala#L76
Oh and everything is plural. There's no dsl.Action vs dsl.Actions; the type is always the plural form even if the value contains only one action.
@arminio Yes, you're exactly right about JSDependenciesPlugin
David Barri
@japgolly
So it seems some of the documentation has become stale in the post-Scala.JS-1.0-world, @arminio it'd be really appreciated if you would kindly submit a PR, or even an issue with a list of changes you had to make, so that we can update the doc for future users.
And sorry you bumped into a few problems. Glad to hear you got it sorted out
Armin Keyvanloo
@arminio
Thanks for replying to all my queries above @japgolly :thumbsup:
I am planing to create a PR of the test-state documentation once I have everything working.
Would you be able to tell me what's the best way to ask test-state related questions on stackoverflow?
Should I simply tag my test-state questions with scalajs-react?
Armin Keyvanloo
@arminio

So it seems some of the documentation has become stale in the post-Scala.JS-1.0-world, @arminio it'd be really appreciated if you would kindly submit a PR, or even an issue with a list of changes you had to make, so that we can update the doc for future users.

@japgolly PR for a small update to the test-state documentation raised:
japgolly/test-state#144

nafg
@nafg
val state: StateSnapshot[State] = ???
val field1Snapshot = state.zoomStateL(State.field1)
val field2Snapshot = state.zoomStateL(State.field2)

field1Snapshot.setState(x) >> field2Snapshot.setState(y)
Is there any way to make that work?
Because of the way it works it seems like the second setState essentially overrides the first
Is there a way to decompose and then recompose state-setting like that?
mvillafuertem
@mvillafuertem
@japgolly Hi I have been working so far with slinky, I have created a project with some examples of hooks. now I would like to know how to write custom hooks using scalajs-react. Any example using useMemo, useContext or useRef without declaring components? Here my example in Slinky.
Artsiom Miklushou
@mikla

Hi,

Is it okay to have EmptyVDomElement contstucted as VdomElement.apply(null) ?

Carlos Quiroz
@cquiroz
There is an EmptyVdom instance
Artsiom Miklushou
@mikla
Ended up using React.Fragment. Thx
Mathieu Prevel
@mprevel

Hi,

What is the best way to use a callback in a facade exposing a js.Any => js.Any function ?
Should I use a (x:js.Any) => Callback(...).runNow() ?

☮ David Barri ☮ 🖤 ✊🏿
@japgolly_twitter
Hey. The .toJsFn1 method on your callback sounds like what you're looking for.
Mathieu Prevel
@mprevel
Maybe I'm wrong, but I cannot use .toJsFn1 if I need to use the function parameter in the Callback ?
David Barri
@japgolly
Oh my bad I didn't realise you were using the parameter. In that case, you've got two options: (1) exactly what you wrote above, (2) use CallbackKleisli and then call .toJsFn. (1) is nice and simple and (2) is a great option if you're doing lots of composition but in many cases it's likely to just be over-engineering for no benefit so you'll have to access your situation and choose whichever's best. Hope that helps
Mathieu Prevel
@mprevel
Thanks. :) In my current case it is a simple Callback that reads the event target value to update the current component state, so I'll go for (1). But it is good to know about option (2) for more complex cases.
Binh Nguyen
@ngbinh
have anyone tried to update to reactjs 1.7.0? https://reactjs.org/blog/2020/10/20/react-v17.html not sure if scala.js react will just work with it
nafg
@nafg
The only breaking changes listed seem to be behavior changes not api changes, so it should be fine
Tom Lin
@tom91136

Hi @japgolly, I'm currently using scalablytyped definitions with react-window. Their constructor for the FixedSizeList component was translated as following:

object FixedSizeList {
 // ...
 def apply(
    children: ComponentType[ListChildComponentProps],
    height: Double | String,
    itemCount: Double,
    itemSize: Double,
    width: Double | String
  ) { ...}
  // ...
}

where ComponentType is:

  type ComponentType[P] = (japgolly.scalajs.react.raw.React.ComponentClassP[P with js.Object]) | typings.react.mod.FunctionComponent[P]

I've been trying to pass in a simple component and no matter what I try I can't get it to compile.
The closest I've got was this:

val comp = ScalaComponent.builder[ListChildComponentProps]("a").render_P { x => <.div("foo") }

Window.FixedSizeList(height = 800, width = 800, itemSize = 200, itemCount = 42,
                    children = ViaReactComponent(comp))

But then it returns boxed props and states so a mismatch again.
Any pointers on how I could get this to work?

Øyvind Raddum Berg
@oyvindberg
@tom91136 there's a fairly high chance that ComponentType is not the perfect type here, I haven't given this pattern much thought. Tell me if you find something better. The important thing is that what's taken as children here is the javascript version of a component, I'm fairly sure there is a way to go from a scala component to a js component
Tom Lin
@tom91136
@oyvindberg From what I can see, the original TypeScript definition (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/fb606b70c8e67c4078b6eecec9ebf13918778002/types/react-window/index.d.ts#L119) is directly translated by the scalablytyped plugin.
I've tried pretty much everything on the interop page but the types just don't seem to match up. If I cast it then I get a ClassCastException
Ryan Richt
@ryan-richt
Hello all! Venturing into using Test-State for an sjs-react app ... question @japgolly , I have a component that async loads another element into the page and I want to test that it indeed (eventually) exists. I'm using JS side tests so it looks like I cannot use Test.withRetryPolicy(policy) Is there another option?
Ryan Richt
@ryan-richt
or maybe I need to throw a ReactTestUtils.act( in somewhere? 🤔
Øyvind Raddum Berg
@oyvindberg
That's true, but the two possibilities for ComponentType I have picked, without too much thought so far. If you PR a WIP demo to the scalajs-react demo repo I can make it work for you @tom91136
Tom Lin
@tom91136
@oyvindberg will do :) just to make sure I understand you correctly, the PR will basically be an extra demo app with react-window (or any typing that happens to use ComponentType[A])
Øyvind Raddum Berg
@oyvindberg
@tom91136 exactly :)
nafg
@nafg
1.7.6 dropped support for sjs0.6 intentionally?
Ryan Richt
@ryan-richt
bah, and sadly it appears ReactTestUtils.actAsync is not implemented for the scalajsreact node env (requires MessageChannel so throws a deep react error) so that's not the solution either...
nafg
@nafg
Turns out it was unintentionally not published, and David now published it
Tom Lin
@tom91136
@oyvindberg PR ScalablyTyped/ScalaJsReactDemos#6 sent
Roberto Leibman
@rleibman
Hi @oyvindberg , it's been a while, I'm refreshing my projects. I don't have a lot of time to move from apply methods to the builder style, so I'm using the stEnableLongApplyMethod variable, but the apply methods are not being generated.
Roberto Leibman
@rleibman
This is my project, btw: https://github.com/rleibman/chuti
Øyvind Raddum Berg
@oyvindberg
I'll have a look @rleibman :)
Roberto Leibman
@rleibman
Thanks!
Øyvind Raddum Berg
@oyvindberg
@rleibman never generated nor just not in a few cases?
Roberto Leibman
@rleibman
I'm only using Semantic ui in this particular project, as far as I can tell, all of 'em
Øyvind Raddum Berg
@oyvindberg
@rleibman the stEnableLongApplyMethod mechanism wasn't implemented for react flavours. I added it here ScalablyTyped/Converter@a28e107 (along with a note that it's deprecated)
Roberto Leibman
@rleibman
Thank you!
Roberto Leibman
@rleibman
@oyvindberg haha, sorry, I should have posted this in the ScalablyTyped channel, I saw your name mentioned here and I thought that was it. Anyway, that worked, thanks again, and I promise I'll get around to changing to use Builders
BTW, the "key" parameter is not coming through. I know that one is a special thing.