-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Make record name editable on show page #9172
base: main
Are you sure you want to change the base?
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.
PR Summary
This PR adds record name editing functionality in the show page header and breadcrumb navigation, with conditional rendering based on field visibility.
- Added new
RecordEditableName
component in/pages/object-record/RecordEditableName.tsx
for inline name editing with proper loading states - Modified
RecordShowPageHeader
to conditionally render editable name whenlayout.hideSummaryAndFields
is true - Made
Icon
prop optional inNavigationDrawerInput
andNavigationDrawerItem
components to support breadcrumb editing - Added Storybook story with GraphQL mocks to test
RecordEditableName
rendering and interactions - Exposed
objectMetadataItem
throughuseRecordShowPagePagination
hook to support metadata access for name editing
8 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
graphql.query('FindOneWorkflow', () => { | ||
return HttpResponse.json({ | ||
data: { | ||
workflow: { | ||
__typename: 'Workflow', | ||
id: '1', | ||
name: 'My Workflow', | ||
}, | ||
}, | ||
}); | ||
}), |
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.
logic: mock response missing mutation handler for updating the workflow name
const { layout } = useRecordShowContainerTabs( | ||
false, | ||
objectNameSingular as CoreObjectNameSingular, | ||
false, | ||
objectMetadataItem, | ||
); |
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.
style: useRecordShowContainerTabs is called with hardcoded false values that could be derived from props or context
@@ -17,13 +20,33 @@ export const RecordShowPageHeader = ({ | |||
navigateToPreviousRecord, | |||
navigateToNextRecord, | |||
navigateToIndexView, | |||
objectMetadataItem, |
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.
logic: objectMetadataItem is now used but not type-checked - could be undefined from useRecordShowPagePagination
}, | ||
}); | ||
|
||
const [recordName, setRecordName] = useState(record?.name); |
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.
logic: recordName state initialized with record?.name before record is loaded. Could cause undefined initial state. Move this initialization into the useEffect or set an empty string as initial value.
objectMetadataItem, | ||
); | ||
|
||
const hasEditableName = layout.hideSummaryAndFields === true; |
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.
logic: layout.hideSummaryAndFields could be undefined - needs null check or default value
const handleSubmit = (value: string) => { | ||
updateOneRecord({ | ||
idToUpdate: objectRecordId, | ||
updateOneRecordInput: { | ||
name: value, | ||
}, | ||
}); | ||
setIsRenaming(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.
style: handleSubmit should validate that value is not empty/whitespace before updating. Also consider adding error handling for failed updates.
7c110c7
to
7c19f5e
Compare
7c19f5e
to
9a5a87e
Compare
When fields are not displayed in show page, title should be editable
Enregistrement.de.l.ecran.2024-12-20.a.16.04.24.mov