mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-31 00:37:10 +02:00
fix(editor): Fix issue for blinking/jumping UI when switching projects (#22256)
This commit is contained in:
parent
254a53e7bb
commit
6185550971
|
|
@ -168,6 +168,22 @@ describe('ProjectHeader', () => {
|
|||
expect(getByTestId('project-subtitle')).toHaveTextContent(personalSubtitle);
|
||||
});
|
||||
|
||||
it('Personal: should render the correct title when currentProject is null but personalProject exists', async () => {
|
||||
settingsStore.isDataTableFeatureEnabled = false;
|
||||
vi.spyOn(projectPages, 'isOverviewSubPage', 'get').mockReturnValue(false);
|
||||
vi.spyOn(projectPages, 'isSharedSubPage', 'get').mockReturnValue(false);
|
||||
const { getByTestId, rerender } = renderComponent();
|
||||
const personalSubtitle = 'Workflows and credentials owned by you';
|
||||
|
||||
projectsStore.currentProject = null;
|
||||
projectsStore.personalProject = { type: ProjectTypes.Personal } as Project;
|
||||
|
||||
await rerender({});
|
||||
|
||||
expect(getByTestId('project-name')).toHaveTextContent('Personal');
|
||||
expect(getByTestId('project-subtitle')).toHaveTextContent(personalSubtitle);
|
||||
});
|
||||
|
||||
it('Team project: should render the correct title and no subtitle if there is no description', async () => {
|
||||
vi.spyOn(projectPages, 'isOverviewSubPage', 'get').mockReturnValue(false);
|
||||
vi.spyOn(projectPages, 'isSharedSubPage', 'get').mockReturnValue(false);
|
||||
|
|
|
|||
|
|
@ -59,12 +59,20 @@ const headerIcon = computed((): IconOrEmoji => {
|
|||
}
|
||||
});
|
||||
|
||||
const homeProject = computed(() => projectsStore.currentProject ?? projectsStore.personalProject);
|
||||
|
||||
const isPersonalProject = computed(() => {
|
||||
return homeProject.value?.type === ProjectTypes.Personal;
|
||||
});
|
||||
|
||||
const projectName = computed(() => {
|
||||
if (!projectsStore.currentProject) {
|
||||
if (projectPages.isSharedSubPage) {
|
||||
return i18n.baseText('projects.header.shared.title');
|
||||
} else if (projectPages.isOverviewSubPage) {
|
||||
return i18n.baseText('projects.menu.overview');
|
||||
} else if (isPersonalProject.value) {
|
||||
return i18n.baseText('projects.menu.personal');
|
||||
}
|
||||
return null;
|
||||
} else if (projectsStore.currentProject.type === ProjectTypes.Personal) {
|
||||
|
|
@ -91,12 +99,6 @@ const showSettings = computed(
|
|||
projectsStore.currentProject?.type === ProjectTypes.Team,
|
||||
);
|
||||
|
||||
const homeProject = computed(() => projectsStore.currentProject ?? projectsStore.personalProject);
|
||||
|
||||
const isPersonalProject = computed(() => {
|
||||
return homeProject.value?.type === ProjectTypes.Personal;
|
||||
});
|
||||
|
||||
const showFolders = computed(() => {
|
||||
return (
|
||||
settingsStore.isFoldersFeatureEnabled &&
|
||||
|
|
@ -475,7 +477,6 @@ const onSelect = (action: string) => {
|
|||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding-bottom: var(--spacing--lg);
|
||||
min-height: var(--spacing--3xl);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user