Fix the crash of the app page when object view is configured to open only on record page.#16977
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:14871 This environment will automatically shut down when the PR is closed or after 5 hours. |
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts">
<violation number="1" location="packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts:88">
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.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| resetNavigationStack: true, | ||
| }); | ||
| } else { | ||
| closeCommandMenu(); |
There was a problem hiding this comment.
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
… recoilcallback function to ensure correctness
| onClick={() => { | ||
| createNewIndexRecord({ | ||
| onClick={async () => { | ||
| closeCommandMenu(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
I have done the suggested changes. Please check on it.
| resetNavigationStack: true, | ||
| }); | ||
| } else { | ||
| closeCommandMenu(); |
… into 16577-crash-app-page
|
Hey @charlesBochet! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
|
Hey @charlesBochet! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
|
Thanks @araj00 for your contribution! |

Problem:
If the command menu page is kept opened while navigating to record show page then the app crashes.
Root cause
When navigatiing to a record show page while the command menu page is kept opened, it tries to open the record show page with command menu open, as its state were set to true , before navigating to a new page along with the instance id of previous context which are used in the current context while rendering the page. Hence, leading to an error page.
Changes
while navigation to a record show page the command menu open state is set to false. This is to handle the navigation gracefully
Fixes: #16577