-
Notifications
You must be signed in to change notification settings - Fork 18
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
Carry over ft
query param while navigating
#174
Comments
Persistence of the ft query is something I've been pondering about for a while, but haven't had time to test any ideas. localstorage could work, here are some concerns I have.
Both of the above issues could be eased by adding a UI, as suggested in #173 , but I also have a few concerns about adding a UI.
The idea I have been working on was creating a function that needs to be applied to every URL in the app that needs to respect ft params. // current window location = www.domain.com/baz?ft=apple,orange
const MyComponent = () => (
<div>
<Link to={addFeatureToggleParams('/foo/bar')} /> // www.domain.com/foo/bar?ft=apple,orange
</div>
); It could also be used for react router // current window location = www.domain.com/baz?ft=apple,orange
const MyComponent = () => (
<div>
<Link to={{ pathname: '/foo/bar', search: addFeatureToggleParams('') }} /> // www.domain.com/foo/bar?ft=apple,orange
</div>
); Preferably this function would be hidden inside an app helper or something that would be used for all internal URLs. The benefit of this we can add/remove functionality as needed for the app URLs from the one function. import { createURL } from 'helpers'
// current window location = www.domain.com/baz?ft=apple,orange
const MyComponent = () => (
<div>
<Link to={createURL('/foo/bar')} /> // www.domain.com/foo/bar?ft=apple,orange
</div>
); Another benefit is that this function could also be applied to API paths so that we can send the correct feature toggle signals to the API to support additional endpoints etc. Not sure which idea is better or if there is an even better solution, but we do need one. Input would be appreciated. |
Would be nice for the ft query param to carry over while navigating the site.
Example:
I'm in http://localhost:3001/?ft=nav-buttons,footer,register,auth
I click on the Sign Up button
I'd like to be taken to http://localhost:3001/register?ft=nav-buttons,footer,register,auth
I'm instead directed to http://localhost:3001/register, which shows nothing at the moment
Labeling this as testing because that's where I'd use it, personally.
Implementation
I'm guessing the simplest option would be to use localstorage as the single source of truth for the value of ft, updating only it if ft is present.
The text was updated successfully, but these errors were encountered: