Please sanity test my query modification functions [Suggestion?]
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, react-native
- Domain
- mobile
Research direction
No repository files or tests are named. Start by reviewing the existing routing and location-query APIs, then compare the proposed addQuery, removeQuery, and getQuery helpers with the project's intended usage. Done would require a maintainer decision on whether this approach fits and what, if anything, should be added.
Written by the indexing model from the issue text.
Description
Hi,
I threw together some quick & dirty helper functions for modifying the "query string".
I'm not very familiar with this project, and I was wondering:
Question: Is the following approach is (broadly) aligned with the intended usage of this project?
import qs from 'query-string';
/**
* Warning: I don't know if anything relies on query-string format,
* but I will keep for convention
*/
export const removeQuery = (prevLocation = {}, history, ...queryKeys) => {
const location = Object.assign({}, prevLocation);
const searchObj = qs.parse(location.search);
queryKeys.forEach(q => delete searchObj[q]);
location.search = qs.stringify(searchObj);
history.push(location);
};
export const addQuery = (prevLocation = {}, history, queryObj) => {
const location = Object.assign({}, prevLocation);
const searchObj = Object.assign(
qs.parse(location.search),
queryObj
);
location.search = qs.stringify(searchObj);
history.push(location);
};
export const getQuery = (prevLocation = {}, queryKey) => {
const searchObj = qs.parse(prevLocation.search);
return searchObj[queryKey];
};
Thanks
- Dominant language
- JavaScript
- Stars
- 636
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jmurzy/react-router-native
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 1/5 Under an hour Newbie friendliness 10/100
jmurzy/react-router-native#81 · 5 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
jmurzy/react-router-native#79 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
jmurzy/react-router-native#78 · 2 comments · 3 reactions ·
-
Difficulty 1/5 Under an hour Newbie friendliness 25/100
All issues in jmurzy/react-router-native
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
keyxmakerx/Chronicle#2284 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
soroswap/token-list#125 ·
Maintainers usually reply within 1 day
-
marketing
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
EveryInc/compound-engineering-plugin#2085 ·
Maintainers usually reply within 1 day