Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Expand All @@ -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)};
Expand All @@ -30,6 +31,8 @@ export const RecordCalendarAddNew = ({
const { objectMetadataItem } = useRecordCalendarContextOrThrow();
const theme = useTheme();

const { closeCommandMenu } = useCommandMenu();

const { createNewIndexRecord } = useCreateNewIndexRecord({
objectMetadataItem,
});
Expand Down Expand Up @@ -71,6 +74,7 @@ export const RecordCalendarAddNew = ({
return (
<StyledButton
onClick={() => {
closeCommandMenu();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel:

  • this should actually be part of createNewIndexRecord
  • and we should call it only if the view is set to navigate to a new record page

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done the suggested changes. Please check on it.

createNewIndexRecord({
[calendarFieldMetadataItem.name]: cardDate
.toZonedDateTime(userTimezone)
Expand Down
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';
Expand Down Expand Up @@ -39,6 +40,8 @@ export const useOpenRecordFromIndexView = () => {
recordIndexId,
);

const { closeCommandMenu } = useCommandMenu();

const openRecordFromIndexView = useRecoilCallback(
({ snapshot, set }) =>
({ recordId }: { recordId: string }) => {
Expand Down Expand Up @@ -82,6 +85,7 @@ export const useOpenRecordFromIndexView = () => {
resetNavigationStack: true,
});
} else {
closeCommandMenu();
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Missing closeCommandMenu in the useRecoilCallback dependency array. While closeCommandMenu is memoized in useCommandMenu, it should still be listed as a dependency to ensure correctness and avoid potential stale closure issues.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts, line 88:

<comment>Missing `closeCommandMenu` in the `useRecoilCallback` dependency array. While `closeCommandMenu` is memoized in `useCommandMenu`, it should still be listed as a dependency to ensure correctness and avoid potential stale closure issues.</comment>

<file context>
@@ -83,7 +85,7 @@ export const useOpenRecordFromIndexView = () => {
           });
         } else {
-          set(isCommandMenuOpenedState, false);
+          closeCommandMenu();
           navigate(AppPath.RecordShowPage, {
             objectNameSingular,
</file context>

✅ Addressed in a7ca1a8

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one looks good

navigate(AppPath.RecordShowPage, {
objectNameSingular,
objectRecordId: recordId,
Expand Down
Loading