Comments (8)
I'm consistently blowing up my session storage quota.
How will disabling the hash history query key help you with that?
from history.
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.
@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.
@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.
@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.
@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.
How can I turn if off for 'history/lib/createBrowserHistory'
?
from history.
See #163
It's not super high priority though because hash history is really only for older browsers.
from history.
Related Issues (20)
- Named exports donβt work with Node.js ESM support HOT 1
- Sourcemaps are blank HOT 1
- Use History in redux actions HOT 2
- Location type should have template for unknown for state HOT 3
- doing history.go() does NOT trigger a blocker callback handler HOT 1
- Did TS declaration file disappear for v4? HOT 4
- Wrong action after clicking on Forward button in browser HOT 3
- Need history.BackTo(string)
- Is it possible to access the history bundled into React Router? HOT 1
- globalHistory.pushState function excuted failed in baidu.app
- [v6] Missing hashType={"noslash"} of HashRouter HOT 3
- [react-router-dom v6] HashRouter support HOT 1
- Add index property to BrowserHistory, HashHistory and corresponding Update
- Why `history.length` is gone? HOT 7
- createBrowserHistory() breaks history URL on iOS 11
- history
- is this project abandoned? HOT 2
- Navigate replace without generate new location.key
- hash history url is not parsed correctly with query params
- ReferenceError: document is not defined in Next.JS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from history.