-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable query injection when key exists already #396
Conversation
This would solve #383 too. Thanks, I'll be using your fork until this is merged. |
Sorry for slow response. LGTM! |
This introduced a bug. The reducer Here's an example: in our product a Lightstep, we use query params for the chart time window ( I think the Would that work for you @dr3? PS: for anyone finding this, use the import { parse, stringify } from 'qs';
import { createSelector } from 'reselect';
const selectQueryParams = (state) => state.router.location.search; // state.router may be different for you
export const getURLParams = createSelector(selectQueryParams, (queryParams) =>
parse(queryParams, { ignoreQueryPrefix: true })
); |
Ah, apologies @tedpennings. Its been a while since I worked on router, I havent tried this out, but in my usage const history = qhistory(createBrowserHistory(), stringify, parseQueryString); my worry would be that when search does change, it would override the output of |
@dr3 that's reasonable. I'm not very familiar with Also, what does |
When using ConnectedRouter you may have already set a query with a custom parser like this
This PR ensures it doesn't override existing queries which may have different parsing logic
Ive published this under https://www.npmjs.com/package/@dr3/connected-react-router for the meantime :)