{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/react-router/issues/3293","repository_url":"https://api.github.com/repos/reactjs/react-router","labels_url":"https://api.github.com/repos/reactjs/react-router/issues/3293/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-router/issues/3293/comments","events_url":"https://api.github.com/repos/reactjs/react-router/issues/3293/events","html_url":"https://github.com/reactjs/react-router/issues/3293","id":148080927,"number":3293,"title":"Active state not working correctly on links with query strings","user":{"login":"AndrewIngram","id":35227,"avatar_url":"https://avatars.githubusercontent.com/u/35227?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewIngram","html_url":"https://github.com/AndrewIngram","followers_url":"https://api.github.com/users/AndrewIngram/followers","following_url":"https://api.github.com/users/AndrewIngram/following{/other_user}","gists_url":"https://api.github.com/users/AndrewIngram/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewIngram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewIngram/subscriptions","organizations_url":"https://api.github.com/users/AndrewIngram/orgs","repos_url":"https://api.github.com/users/AndrewIngram/repos","events_url":"https://api.github.com/users/AndrewIngram/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewIngram/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-13T14:34:46Z","updated_at":"2016-04-13T19:35:00Z","closed_at":"2016-04-13T18:29:17Z","body":"### Scenario\r\n\r\nI have a link in my global header to page with a filterable list of objects. The link includes a query parameter, because the starting state of the list is to already have a filter applied. The link looks something like this:\r\n\r\n```\r\n<Link \r\n  className=\"menuitem\" \r\n  activeClassName=\"active\" \r\n  to={{pathname: '/tickets', query: {status: 'open'}}}>Tickets</Link>\r\n```\r\n\r\nWhen I click the link and the page loads, the active class is correctly added to the link.\r\n\r\n### Problem\r\n\r\nWhen I change the filters, e.g. changing the path to just `/tickets` or `/tickets?status=closed` the active state is removed from the links.\r\n\r\n### What I expect\r\n\r\nI expect query strings to be ignored for all consideration of what is the active path. Links behave as expected if they link to the naked pathname, rather than one with a query string (i.e adding filters preserves the active behaviour), but break when the link itself contains a query.\r\n\r\n### Versions affected\r\n\r\nOnly observed with 2.0+, but no reason to assume the problem didn't exist before."},"comment":{"url":"https://api.github.com/repos/reactjs/react-router/issues/comments/209614169","html_url":"https://github.com/reactjs/react-router/issues/3293#issuecomment-209614169","issue_url":"https://api.github.com/repos/reactjs/react-router/issues/3293","id":209614169,"user":{"login":"timdorr","id":17882,"avatar_url":"https://avatars.githubusercontent.com/u/17882?v=3","gravatar_id":"","url":"https://api.github.com/users/timdorr","html_url":"https://github.com/timdorr","followers_url":"https://api.github.com/users/timdorr/followers","following_url":"https://api.github.com/users/timdorr/following{/other_user}","gists_url":"https://api.github.com/users/timdorr/gists{/gist_id}","starred_url":"https://api.github.com/users/timdorr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timdorr/subscriptions","organizations_url":"https://api.github.com/users/timdorr/orgs","repos_url":"https://api.github.com/users/timdorr/repos","events_url":"https://api.github.com/users/timdorr/events{/privacy}","received_events_url":"https://api.github.com/users/timdorr/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T19:35:00Z","updated_at":"2016-04-13T19:35:00Z","body":"> Aside: if you're asking me a follow-up question, shouldn't you wait for my reply before closing the ticket?\r\n\r\nIt was rhetorical. Sorry if it came off snarky. There's really a few different ways to define \"active\"-ness of a URL. We've chosen one that works well for most people and the decision is made. There's not really anything actionable here.\r\n\r\nWhat would make a better issue is the discussion and consideration of more expressive \"active\" checking. For instance, having props like `activePathClassName`, `activePartialPathClassName`, `activePartialQueryClassName`, etc etc to check various partial or exact \"active\" states. There is probably a more concise and flexible means of doing that. If there's a specific suggestion, that would be greatly appreciated. "}}