-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Page: Add inline rename functionality #68828
Conversation
@@ -95,7 +96,7 @@ export function AutoSaveField<T = string>(props: Props<T>) { | |||
disabled={disabled} | |||
error={error || (fieldState.showError && saveErrorMessage)} | |||
ref={fieldRef} | |||
className={styles.widthFitContent} | |||
className={classNames(styles.widthFitContent, restProps.className)} |
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.
😬 Not enthusiastic about supporting class name prop for new UI components.
I guess this is so we can make the input large to match the H1.... do we want/need a new lg/xl size for the text box instead? @eledobleefe
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.
Actually, do you even use this component here?
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.
oh yeah I didn't use Autosavefield in the end so can remove this change 👌
The time it takes for the Input to disappear after I've blurred or pressed enter feels a little bit clunky. I would prefer the frontend would directly flip to the edited title, and then flip back and display an error if it fails. |
@tskarhed done 👍 you're right, it feels much snappier 😍 |
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.
Excellent work. This is thoughly developed, tested, and thought about - well done 👏🏻
I'm a little bit uncertain on the interaction, especially with how it's just.... saved automatically without much feedback on blur, but happy to defer to others and see what it's like in practice.
(just the two small comments)
const [isEditing, setIsEditing] = useState(false); | ||
const [isEditInProgress, setIsEditInProgress] = useState(false); |
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 found these two names pretty confusing. Maybe we could rename isEditInProgress
to isLoading
?
{/* | ||
use localValue if it exists | ||
this is to prevent the title from flickering back to the old value after the user has edited | ||
caused by the delay between the save completing and the new value being refetched | ||
*/} | ||
<H1 truncate>{localValue ?? value}</H1> |
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 think there's an iffy bit here where the parent cannot change the value
prop after its ever been edited?
I think this is an instance where we want to react to changes in the value
prop and sync it to state.
const [localValue, setLocalValue] = useState(value);
useEffect(() => {
setLocalValue(value);
}, [value])
(this should not cause a re-render on first mount as the value doesn't change)
@joshhunt applied your changes and adjusted the css for the title - should be more consistent now. |
What is this feature?
EditableTitle
componentonEditTitle
prop on thePage
componentonEditTitle
is present, useEditableTitle
as the page title to provide inline rename capabilitiesWhy do we need this feature?
Who is this feature for?
Which issue(s) does this PR fix?:
Fixes #68070
Special notes for your reviewer:
Please check that: