Coder Social home page Coder Social logo

cellog / ion-router Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 1.0 13.45 MB

elegant powerful routing based on the simplicity of storing url as state

Home Page: https://cellog.github.io/ion-router

License: MIT License

JavaScript 1.36% Shell 1.55% TypeScript 97.09%
router react redux routing ion-router dynamic-routes asynchronous redux-state redux-store

ion-router's Introduction

Ion Router Logo

ion-router

Connecting your url and redux state

Code Climate Test Coverage Build Status npm

Elegant powerful routing based on the simplicity of storing url as state

To install:

$ npm i -S ion-router

New Documentation

Our documentation now lives here

License

MIT License

Thanks

http://www.browserstack.com

Huge thanks to BrowserStack for providing cross-browser testing on real devices, both automatic testing and manual testing.

ion-router's People

Contributors

cellog avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ion-router's Issues

enhanced routes need to be store-specific

Currently, enhanced routes are a global variable. We need to attach them to the store instead, or it becomes impossible to use 2 instances of redux inside the same app (which is rare, but it is needed in the documentation website for this very router, so we need to fix this)

Toggle never sets active if the component state isn't loaded yet

Because of this portion of Toggle.jsx:

  const scaffold = (state, rProps) => {
    const loadedTest = !!loaded(state, rProps)
    return {
      ...rProps,
      '@@__isActive': loadedTest && !!isActive(state, rProps),
      '@@__loaded': loadedTest
    }
  }

@@__isActive never returns true when the component isn't loaded. The loadedTest should be removed.

query string parse/stringify

Hey,
There were always 2 major painpoints with react router v4:

  • No native redux integration
  • Query strings stripped away

ion-router seems really cool, but queries are not mentioned anywhere. Any possibility to use them, and how? Could we have some parseQuery and stringifyQuery methods to adapt the functionality?

Thanks, keep it up!

Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

I am getting the following error:
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

if I have multiple <Route> inside <Routes> component. This might be due to React.cloneElement inside Routes.jsx (see http://stackoverflow.com/questions/38011702/how-to-clone-multiple-children-with-react-cloneelement).

race condition on using back/forward to change URL

Because the sagas listening for state changes to update the URL run asynchronously, they tend to run just as the saga listening for URL changes is running. This then causes a back-and-forth update remove of URL based on state and locks up the browser.

The solution is to put an action marking the beginning of state transitions from a URL, and then another action marking the end, much like BEGIN/COMMIT from SQL world. Then the locationFromState listener will simply pause on BEGIN until COMMIT is received.

Love this - wasn't able to get it to work though

Just wanted to say - thank you for making this.
I really don't like all the solutions available now for redux routing and this is more or less what I thought about making on my own. I'm glad someone else is making it :)

Obviously it's in a very early state, but as far as I can tell, it doesn't work with what the guidelines in the README provide.

As far as I can tell, the issue I ran into is that listenForRoutes is never registered, which means that CREATE_ROUTE doesn't really add a route.
At this point I gave up (it's probably surmountable but too much fiddling doesn't really fit into what I'm doing at this time).

If you want any help, let me know.

A few things to note:

  1. I couldn't get it to work with create-react-app off the bat, I needed to add require('babel-polyfill') at the top entry point - though other libraries with generators work. Might want to think about building the lib with inlined "regenerator runtime", though I don't remember how to do that.
  2. If all works as intended, you'll get CREATE_ROUTE and ADD_ROUTE actions in the redux history for every route that exists. This really pollutes the history and will cause a lot of re-rendering, might want to think of a different solution - all of it should probably be in the initial state of the reducer somehow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.