Fix deactivated tabs not visible in new tab action (#19811)
## Context On custom objects, clicking "+ New Tab" on a record page layout never exposed deactivated tabs for reactivation, even though isActive: false tabs were correctly returned by the API. Standard objects worked fine. ## Fix isReactivatableTab gated reactivation on tab.applicationId === objectMetadata.applicationId. For custom objects these two ids are intentionally different. This check was unnecessary after all, we simply want to check if a tab is inactive (only non-custom entities can be de-activated) 👍 <img width="694" height="551" alt="Screenshot 2026-04-17 at 18 14 28" src="https://github.com/user-attachments/assets/42485cb2-8be5-4a55-a311-479ed3226908" />
This commit is contained in:
+5
-25
@@ -17,35 +17,15 @@ const makeTab = (overrides: Partial<PageLayoutTab> = {}): PageLayoutTab =>
|
||||
}) as unknown as PageLayoutTab;
|
||||
|
||||
describe('isReactivatableTab', () => {
|
||||
it('should return true when tab is inactive and applicationId matches', () => {
|
||||
const tab = makeTab({ isActive: false, applicationId: 'app-1' });
|
||||
it('should return true when tab is inactive', () => {
|
||||
const tab = makeTab({ isActive: false });
|
||||
|
||||
expect(isReactivatableTab({ tab, objectApplicationId: 'app-1' })).toBe(
|
||||
true,
|
||||
);
|
||||
expect(isReactivatableTab(tab)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when tab is active', () => {
|
||||
const tab = makeTab({ isActive: true, applicationId: 'app-1' });
|
||||
const tab = makeTab({ isActive: true });
|
||||
|
||||
expect(isReactivatableTab({ tab, objectApplicationId: 'app-1' })).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it('should return false when applicationId does not match', () => {
|
||||
const tab = makeTab({ isActive: false, applicationId: 'app-1' });
|
||||
|
||||
expect(isReactivatableTab({ tab, objectApplicationId: 'app-2' })).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it('should return false when objectApplicationId is undefined', () => {
|
||||
const tab = makeTab({ isActive: false, applicationId: 'app-1' });
|
||||
|
||||
expect(isReactivatableTab({ tab, objectApplicationId: undefined })).toBe(
|
||||
false,
|
||||
);
|
||||
expect(isReactivatableTab(tab)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import { type PageLayoutTab } from '@/page-layout/types/PageLayoutTab';
|
||||
|
||||
export const isReactivatableTab = ({
|
||||
tab,
|
||||
objectApplicationId,
|
||||
}: {
|
||||
tab: PageLayoutTab;
|
||||
objectApplicationId: string | undefined;
|
||||
}): boolean => {
|
||||
return !tab.isActive && tab.applicationId === objectApplicationId;
|
||||
};
|
||||
export const isReactivatableTab = (tab: PageLayoutTab): boolean =>
|
||||
!tab.isActive;
|
||||
|
||||
Reference in New Issue
Block a user