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 10:57
  • Jan 30 22:22
    bitpirate starred japgolly/scalajs-react
  • Jan 30 08:11

    japgolly on master

    Update docs for changes in 1.4.0 (compare)

  • Jan 28 08:08
    booleguo starred japgolly/scalajs-react
  • Jan 28 04:09

    japgolly on v1.4.0

    (compare)

  • Jan 28 04:05

    japgolly on master

    Towards v1.4.1 (compare)

  • Jan 28 04:04

    japgolly on master

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

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

    japgolly on v1.4.x

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

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

    japgolly on v1.4.x

    Test AsyncCallback.init Update Travis CI caching (compare)

  • Jan 28 03:02

    japgolly on v1.4.x

    Update Travis CI cache dirs Revise changelog (compare)

  • Jan 28 03:00
    japgolly labeled #520
  • Jan 28 03:00
    japgolly labeled #519
  • Jan 27 17:36
  • Jan 26 06:49
    japgolly commented #520
  • Jan 26 05:55
    japgolly commented #519
  • Jan 26 02:35
    cquiroz opened #520
Matt Hughes
@matthughes
Now that React has gotten away with isMounted, how are folks handling components that poll?
  • Make request
  • Component is unmounted
  • Request finally completes; schedules new request on unmounted component
Matt Hughes
@matthughes
UnMount/TimerSupport doesn’t help here. The latter will cancel outstanding timers on unmount, but if the request is really long, it’s like a timer of its own. Request is still chugging along and then comes back to an unmounted component.
Kai Matsuda
@vangogh500

Hey guys dealing with a peculiar bug here:

japgolly.scalajs.react.extra.router.Router[design.hamu.util.webui.routing.AppPage] does not take parameters
[error]   def apply() = component()
[error]                          ^

Here is the source code:

object AppRouter {
  val config = RouterConfigDsl[AppPage].buildConfig { dsl =>
    import dsl._
    (emptyRule
    | staticRoute("/", Home) ~> render(Navbar())
    ).notFound(redirectToPage(Home)(Redirect.Replace))
  }
  val component = Router.apply(BaseUrl.fromWindowOrigin_/, config)
  def apply() = component()
}

If anyone can help out I'd much appreciate it! Thanks!

Kai Matsuda
@vangogh500
Interesting doing Router.componentUnbuilt(BaseUrl.until_#, config).build works... but that's what apply does...
Haven't dug deep but suspect it has to do with the casting to Router[_]
did u guys ever had the problem to redirect the user to a login page if they were not "logged in"
and this route ^ works "fine"
even though the user is not "logged in"
this is where the app tells, if the user is logged in or not ^
so the question is, how can I create a router config that depends on whether the user is logged in or not ?
jhegedus42
@jhegedus42
well, i am giving this a try now
it did not really work ...
so basically here ^
the route would depend on the variable
if the user is logged in or not ...
but this does not really seem to work...
jhegedus42
@jhegedus42
maybe the "login page" should be entirely independent from the router
anyway.... i am sure its not impossible to figure this one out, but maybe i am not the first one to encounter this log-in problem :)
or am i ?
jhegedus42
@jhegedus42
anyway... i put aside this login problem now... come back to it later, plz ping me here if you have some idea / or similar problem
jhegedus42
@jhegedus42
or maybe a very simple question : does it make sense to have the router as child of a "main component" which is reponsible for handling log-in ...
where is the routed page mounted ?
can the router be a child of something ?
router.renderIntoDOM(e)
like this ^
where e is :
val e: Element = document.getElementById( "rootComp" )
can e be something else ? and then that something else can contain the router ?
so , does it make sense to put the router "not directly" into the e but rather into a wrapper component ?
and then put that wrapper component into e ?
so that the wrapper component can handle the login ?
jhegedus42
@jhegedus42
or, for example, when the app starts, then it has component a mounted into e
and once the login completed successfully (which is handled by component a) then component a mounts the router into e ?
or should I put an onComponentMounted somewhere which checks if the user is logged in, and if not, then it redirects the route to the login page ?
jhegedus42
@jhegedus42
ok, here is a possible solution :

 def wrapperConstructor(routerCtl: RouterCtl[MainPage]) =
    ScalaComponent
      .builder[CacheAndPropsAndRouterCtrl[Props]]("Wrapper")
      .renderBackend[WrapperBackend]
      .componentWillMount(
        $ => {
          val r1: Callback = Callback {
            ReRenderer.setTriggerer(ReRenderTriggerer(() => {
              $.setState(Unit).runNow()
            }))
          }

          val r2: Callback = routerCtl.set(LoginPage)

          val r3: Callback =
            if (LoginPageComp.isUserLoggedIn.yesOrNo) {
              r1
            } else r2

          r3

        }
      )
      .build
routerCtl.set(LoginPage) should "re route" the app to the login page ...
as far as I imagine
am I using it wrong ?
how can I use the routerCtl to send the app to an other page ?
is this the correct way ?
Yilin Wei
@yilinwei
What version of the library should I be using for scala 2.13? Struggling to find a combo of ScalaJS and this library that it's happy with.
Yilin Wei
@yilinwei
Never mind; the issue was the bundler plugin was causing the correct scalajs compiler to get evicted and the library hasn't been compiled against 1.0.0 yet.