-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix the crash of the app page when object view is configured to open only on record page. #16977
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
Changes from 6 commits
397f61e
4249d5f
a1bbf06
a7ca1a8
2297636
b194441
f6fad4e
30f0c47
52eb012
b24d391
12bbedd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; | ||
| import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject'; | ||
| import { isFieldMetadataReadOnlyByPermissions } from '@/object-record/read-only/utils/internal/isFieldMetadataReadOnlyByPermissions'; | ||
| import { useRecordCalendarContextOrThrow } from '@/object-record/record-calendar/contexts/RecordCalendarContext'; | ||
| import { hasAnySoftDeleteFilterOnViewComponentSelector } from '@/object-record/record-filter/states/hasAnySoftDeleteFilterOnView'; | ||
| import { recordIndexCalendarFieldMetadataIdState } from '@/object-record/record-index/states/recordIndexCalendarFieldMetadataIdState'; | ||
| import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useCreateNewIndexRecord'; | ||
|
|
@@ -11,7 +13,6 @@ import { useRecoilValue } from 'recoil'; | |
| import { type Temporal } from 'temporal-polyfill'; | ||
| import { IconPlus } from 'twenty-ui/display'; | ||
| import { Button } from 'twenty-ui/input'; | ||
| import { useRecordCalendarContextOrThrow } from '@/object-record/record-calendar/contexts/RecordCalendarContext'; | ||
|
|
||
| const StyledButton = styled(Button)` | ||
| padding: ${({ theme }) => theme.spacing(0.5)}; | ||
|
|
@@ -30,6 +31,8 @@ export const RecordCalendarAddNew = ({ | |
| const { objectMetadataItem } = useRecordCalendarContextOrThrow(); | ||
| const theme = useTheme(); | ||
|
|
||
| const { closeCommandMenu } = useCommandMenu(); | ||
|
|
||
| const { createNewIndexRecord } = useCreateNewIndexRecord({ | ||
| objectMetadataItem, | ||
| }); | ||
|
|
@@ -70,8 +73,9 @@ export const RecordCalendarAddNew = ({ | |
|
|
||
| return ( | ||
| <StyledButton | ||
| onClick={() => { | ||
| createNewIndexRecord({ | ||
| onClick={async () => { | ||
| closeCommandMenu(); | ||
|
||
| await createNewIndexRecord({ | ||
| [calendarFieldMetadataItem.name]: cardDate | ||
| .toZonedDateTime(userTimezone) | ||
| .toInstant() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; | ||
| import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; | ||
| import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; | ||
| import { contextStoreRecordShowParentViewComponentState } from '@/context-store/states/contextStoreRecordShowParentViewComponentState'; | ||
|
|
@@ -39,6 +40,8 @@ export const useOpenRecordFromIndexView = () => { | |
| recordIndexId, | ||
| ); | ||
|
|
||
| const { closeCommandMenu } = useCommandMenu(); | ||
|
|
||
| const openRecordFromIndexView = useRecoilCallback( | ||
| ({ snapshot, set }) => | ||
| ({ recordId }: { recordId: string }) => { | ||
|
|
@@ -82,6 +85,7 @@ export const useOpenRecordFromIndexView = () => { | |
| resetNavigationStack: true, | ||
| }); | ||
| } else { | ||
| closeCommandMenu(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Missing Prompt for AI agents✅ Addressed in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one looks good |
||
| navigate(AppPath.RecordShowPage, { | ||
| objectNameSingular, | ||
| objectRecordId: recordId, | ||
|
|
@@ -97,6 +101,7 @@ export const useOpenRecordFromIndexView = () => { | |
| navigate, | ||
| openRecordInCommandMenu, | ||
| isMobile, | ||
| closeCommandMenu, | ||
| ], | ||
| ); | ||
|
|
||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.