GithubHelp home page GithubHelp logo

Comments (8)

mjackson avatar mjackson commented on April 19, 2024

I'm consistently blowing up my session storage quota.

How will disabling the hash history query key help you with that?

from history.

acdlite avatar acdlite commented on April 19, 2024

For a fix to your specific problem, you can also pass history to reduxReactRouter() rather than createHistory(). I'm going to try to mirror the <Router> API as best as I can.

Or you could do what React Router does and pass () => createHistory(options) as your createHistory() function.

https://github.com/rackt/react-router/blob/master/modules/Router.js#L49

I agree that it's a bit weird that useRouting() is a history enhancer (which operates on createHistory()) but the API for configuring the Router involves passing a history object.

This thread probably belongs over at React Router.

from history.

eknuth avatar eknuth commented on April 19, 2024

@mjackson From the hash history caveats I was under the impression that this option would disable the persistent state storage. I'm seeing a different value for _k every time I push or replace state, though.

@acdlite I appreciate your quick response. Should I take this to react router, or redux router?
Unfortunately giving reduxReactRouter an instance of history, or a function that returns an instance doesn't seem to work. :(

let createHistory = (opts) => {
  return createHashHistory({queryKey: false})
}

let reduxRouter = reduxReactRouter({
  routes: routes,
  createHistory: createHistory
})

In my logs I see:

Warning: Failed propType: Required prop `location` was not specified in `RoutingContext`. Check the render method of `ReduxRouterContext`.
warning.js:48 Warning: Failed propType: Required prop `routes` was not specified in `RoutingContext`. Check the render method of `ReduxRouterContext`.

I appreciate the quick response, guys. Thanks!

from history.

amccloud avatar amccloud commented on April 19, 2024

@eknuth what did you end up doing about the storage quota?

To disable queryKey I ended up doing:

function useNoQueryKey(createHistory) {
  return function(options={}) {
    options.queryKey = false;
    return createHistory(options);
  };
}

export default reduxReactRouter({
  createHistory: useNoQueryKey(createHashHistory),
  routes
});

@mjackson is it safe to disable queryKey if you never pass state to the navigation APIs? Would it behave like the old HashHistory in react-router?

from history.

eknuth avatar eknuth commented on April 19, 2024

@amccloud I ended up not disabling the queryKey for history. We just stopped pushing all of our state in the router actions. When you push or replace, the first argument can be an empty string.

from history.

NeXTs avatar NeXTs commented on April 19, 2024

@eknuth You can disable the queryKey this way

import createHistory from 'history/lib/createHashHistory';
...


reduxReactRouter({
  routes: routes,
  createHistory: (options) => createHistory(Object.assign({queryKey: false}, options))
})

The only disadvantage is that it logs warnings to console, although seems it will resolved soon too.
acdlite/redux-router#136

from history.

timaschew avatar timaschew commented on April 19, 2024

How can I turn if off for 'history/lib/createBrowserHistory' ?

from history.

mjackson avatar mjackson commented on April 19, 2024

See #163

It's not super high priority though because hash history is really only for older browsers.

from history.

Related Issues (20)

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.