Skip to content

The open alternative to Salesforce, designed for AI.

Fix: focus stack overwritten when auto-opening title cell on new record (#21029)

Raphaël Bosi1d84695fb022
diff --git a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx
index c76d18b8b6a..2ba2ab38226 100644
--- a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx
+++ b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx
@@ -224,6 +224,23 @@ export const PageChangeEffect = () => {
}
case isMatchingLocation(location, AppPath.RecordShowPage): {
const isNewRecord = location.state?.isNewRecord === true;
+ const isSidePanelOpen = store.get(isSidePanelOpenedState.atom);
+
+ if (!isSidePanelOpen) {
+ resetFocusStackToFocusItem({
+ focusStackItem: {
+ focusId: PageFocusId.RecordShowPage,
+ componentInstance: {
+ componentType: FocusComponentType.PAGE,
+ componentInstanceId: PageFocusId.RecordShowPage,
+ },
+ globalHotkeysConfig: {
+ enableGlobalHotkeysWithModifiers: true,
+ enableGlobalHotkeysConflictingWithKeyboard: true,
+ },
+ },
+ });
+ }
if (
isNewRecord &&
@@ -234,26 +251,6 @@ export const PageChangeEffect = () => {
fieldName: location.state.labelIdentifierFieldName,
});
}
-
- const isSidePanelOpen = store.get(isSidePanelOpenedState.atom);
-
- if (isSidePanelOpen) {
- return;
- }
-
- resetFocusStackToFocusItem({
- focusStackItem: {
- focusId: PageFocusId.RecordShowPage,
- componentInstance: {
- componentType: FocusComponentType.PAGE,
- componentInstanceId: PageFocusId.RecordShowPage,
- },
- globalHotkeysConfig: {
- enableGlobalHotkeysWithModifiers: true,
- enableGlobalHotkeysConflictingWithKeyboard: true,
- },
- },
- });
break;
}
case isMatchingLocation(location, AppPath.SignInUp): {