Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Aug 20 20:21
    klimashkin edited #427
  • Aug 20 20:21
    klimashkin edited #427
  • Aug 19 16:13
    klimashkin opened #427
  • Aug 12 10:15
    gwn edited #426
  • Aug 12 10:07
    gwn opened #426
  • Aug 01 00:08
    pzmosquito opened #425
  • Jul 10 07:34
    sidzan edited #424
  • Jul 10 07:33
    sidzan opened #424
  • Jun 25 23:34
    lid2000 closed #423
  • Jun 24 01:08
    lid2000 opened #423
  • Jun 19 14:14
    matthewgertner edited #422
  • Jun 19 14:12
    matthewgertner opened #422
  • May 09 05:52
    davidosomething opened #421
  • May 06 12:32
    liuxiaocong opened #420
  • May 06 12:32
    liuxiaocong opened #419
  • Apr 24 03:03
    davidosomething opened #418
  • Apr 23 22:02
    dottjt opened #417
  • Apr 16 12:26
    notVitaliy opened #416
  • Apr 12 19:34
    stramel closed #415
  • Apr 12 19:03
    stramel edited #415
Vasiliy Yorkin (meow)
hey guys! do you have an example showing how to write tests for an app that is using router5?
just wanted to know if it possible at all
Vasiliy Yorkin (meow)
^^ nevermind, stupid question, of course it is testable :)
Vasiliy Yorkin (meow)
there is a broken link here: https://github.com/router5/redux-router5#with-react, you can use withContext() from recompose <<
grats on the 1.0.0 release @troch ;)
Dave Irvine
Hi @troch. Got a quick question, perhaps I am massively misunderstanding what is going on here, but you can correct me if so :) With the following code I get the console output line twice:
                        var router = new Router5() 
                                .setOption('useHash', true)
                                .setOption('defaultRoute', 'home') 
                                .addNode('home', '/home')

                        router.addRouteListener('home', function (toState, fromState) {
                                console.log('home route listener hit');

both times, fromState is null
So I don't think I'm actually hitting the route twice, I think the listener is just firing twice. Although I dont know why.
Dave Irvine
Hmm although on the 2nd hit, if I look in the call stack I can see navigateToDefault twice
Thomas Roch
@dave-irvine I'll check that out
@vyorkin thanks, link fixed
@Nickman87 thanks :)
Vasiliy Yorkin (meow)
@troch I’m playing around with redux & friends and discovered this thing: https://github.com/acdlite/flux-standard-action
its seems that there is a covention about action structure
just don’t if its official enough to folow
as I can see redux-router5 doesn't follow this conventions (R5_NAVIGATE, R5_TRANSITION_SUCCESS, etc)
Thomas Roch
No doesn't follow it but there is no reason why it couldn't be the case
Vasiliy Yorkin (meow)
ok, I don’t know if its important or not, just wanted to let you know
Thomas Roch
yes, I am aware of FSA. I'll include it soon.
Vasiliy Yorkin (meow)
there is one more issue with redux-devtools concerning undo functionality (history doesn’t change when I undo/redo R5 actions), I’m going to try to reproduce in router5-examples/apps/react-redux
Thomas Roch
I definitely need to run more checks around this, and get redux-router5 in a more mature state. History can't be rewind though, and there is also be the problem of rewinding part of of a route change transition actions and not all.
@/all 1.1.0 was released today BTW. It adds a feature for passing "additional" arguments to canActivate and canDeactivate functions. No breaking change really, that feature is added for supporting redux-router5. So if redux-router5 is used, canActivate functions receive your store object first: http://router5.github.io/docs/preventing-navigation.html#additional-arguments
Adam Gołąb
import { actionTypes } from 'redux-router5';
import transitionPath from 'router5.transition-path';

const onRouteActivateMiddleware = routes => (router, dependencies) => (toState) => {
    const { toActivate } = transitionPath(action.payload.route, action.payload.previousRoute);

    toActivate.forEach(segment => {
        const routeSegment = routes.find(r => r.name === segment);
        if (routeSegment && routeSegment.onActivate) {
@/all I have encountered following problem. action is not defined. Code is from docs. Should I import something else in this middleware to get loading async data with redux working?
Adam Gołąb
I found what's wrong. In documentation http://router5.github.io/docs/async-data.html instead of action.payload.route should be toState, and instead of action.payload.previousRoute should be fromState passed as second parameters.
Alexander Torn
Hello there. May i ask a question here how to implement transition node functionality in my situation?
Juan Soto
Is there a way to use persistentParamsPlugin with dynamic query params? like ${user.id}_stuff_
Juan Soto
Issue: router5/router5#122
thank god this channel exist
i am reading the docs and I am a bit confused
"allow not found" part
import { constants } from 'router5';

    name: constants.UNKNOWN_ROUTE
    params: { path: '/route-not-found' },
    path: '/route-not-found'
how is this a valid code snippet?
just some random object floating around somewhere
(copy pasted from the doc)
Michael Pardo
Hey, a couple questions: 1) is this the best place to chat about router5? 2) I’m thinking of porting router5 to Java/Kotlin; is there currently an effort to do this?
Thomas Roch
@pardonut there is no effort I know of to port router5 in Java/Kotlin
Tanawat Tassana
Hi @troch I found the issue about createRouteNodeSelector in my project but not really sure it's your intention and I misunderstand sth or not.
let say I have state a.b so I create node selector at a but when I go to a.b, the route that return from selector(state) never change, while selector at '' (root) works well.
I look at the code here: https://github.com/router5/router5/blob/master/packages/redux-router5/modules/lib/routeNodeSelector.js
and found that at line 19 the else is missing. So I hack the code in my node_modules put that else block into dist directory then it works as expected.
I want to fire the issue I found but I need to have it works ASAP. What do you think it is the best way I should do? and if I am wrong please let me know. Thanks.
Thomas Roch
@codewithcats route node selectors update when they are concerned by a transition. If you tell me you have a route node selector a which doesn't update when you go to a.b, well it depends what the previous route is. Without components it's also difficult to know if there is a bug or if you've not connected your components well.
Jean-Pascal Hövel
Hello everybody. I'm having trouble to understand the real sense of nodeName on RouteNode for the react integration. If I switch to another parent node, my old render just stays since the intersection is empty. So when to use RouteNode?
John Cudd
How do I deal with static assets?
Dmitry Kharitonov
Hey! After upgrade to v7 packages VS Code tells me that the react-router5 package has not TypeScript typings. All good with router5 and router5-plugin-browser packages, only react-router5. Is this known issue? I've tried to clean up node_modules and package-lock.json.
Dmitry Kharitonov
Ok, I found the problem. PR submitted router5/router5#387
Hi everyone, is anyone using router5 with Svelte?
Can Router5 be used to implement State Machines and Charts? I'm looking at David Khourshid's Xstate libray and was wondering if Router5 could replace it as a full route/state solution, or if I should really combine the two?
Apparently, Xstate can be a full replacement for Redux. Although, this isn't really that clear from the Xstate Docs, as David presents the library very differently to how Redux is presented/promoted.
Peter Zhang
I use MobX + Router5 for state management and routing. I think they are great combination to implement a state machine.