-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix - add new button on opportunity board company picker doesnt work #8488
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 fixes the "New" button functionality in the opportunity board's company picker by implementing company creation and improving data fetching.
- Added company creation flow in
RecordBoardColumnNewOpportunity.tsx
usingcreateCompanyOpportunityAndOpenRightDrawer
function - Implemented right drawer opening after company creation with proper state management via
viewableRecordIdState
- Added
cache-and-network
fetch policy inuseFilteredSearchEntityQuery.ts
to ensure immediate visibility of newly created companies - Added error handling with
isDefined
checks for company creation responses
2 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
const createdCompany = await createCompany({ | ||
id: newRecordId, | ||
name: searchInput, | ||
}); |
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: No error handling if company creation fails. Could leave UI in inconsistent state.
setViewableRecordId(newRecordId); | ||
setViewableRecordNameSingular(CoreObjectNameSingular.Company); | ||
openRightDrawer(RightDrawerPages.ViewRecord); |
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: State updates and drawer opening should happen after confirming company creation succeeded
@@ -60,6 +60,7 @@ export const useFilteredSearchEntityQuery = ({ | |||
filter: notFilter, | |||
limit: limit ?? DEFAULT_SEARCH_REQUEST_LIMIT, | |||
searchInput: searchFilter, | |||
fetchPolicy: 'cache-and-network', |
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 am not sure about this one!
But the newly created entities won't get fetched without this.
opportunitybutton.mp4