-
Notifications
You must be signed in to change notification settings - Fork 187
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
Rapid exp title changes dependent on new or edit fixes #2901 #2994
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, updating the url in real time is super neat, this is where using react really starts to shine >:D
See if you can use the experiment data instead of the url.
I like the behaviour of the default header for the create page vs the name on the edit page. If you can use the experiment data itself, we might get that fancy real time updating behaviour on both pages which would be neat.
Good job!
const ExperimentFormPage: React.FC = () => { | ||
const { location } = useHistory(); | ||
let pageHeading = "Create a New A/A Experiment"; | ||
if (location.pathname.includes("edit")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we look at the experiment data to see if it has a name instead of looking at the url?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so... i took a stab at only using experiment data. Since the name data value changes when a user changes the name in the text field, I couldn't think of a way how would that indicate whether the experiment was new, or an edit. I decided on using the presence of a slug in the experiment data instead?
} | ||
|
||
return ( | ||
<div className="mb-4"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below this was wrapped in a <div className="col pt-3">
(see deleted L9 in app/experimenter/static/rapid/components/pages/ExperimentFormPage.tsx).
Not sure if that is still needed, but 🤷 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intially had it, but it gave me a weird indent 🤷♀️. Not exactly the best with front end stuff 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes using slug is exactly correct, good thinking 👍
Not entirely sure if it's desirable but when changing the public name, the title will change to match it....