fix(editor): Refresh insights weekly summary when entering any of the /home routes (#21859)

This commit is contained in:
Guillaume Jacquart 2025-11-14 10:12:17 +01:00 committed by GitHub
parent d5832c34ed
commit c3e6439303
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 6 deletions

View File

@ -4,7 +4,6 @@ import { useExternalHooks } from '@/app/composables/useExternalHooks';
import { useTelemetry } from '@/app/composables/useTelemetry';
import { useToast } from '@/app/composables/useToast';
import { EnterpriseEditionFeature, VIEWS } from '@/app/constants';
import { useInsightsStore } from '@/features/execution/insights/insights.store';
import type { UserManagementAuthenticationMethod } from '@/Interface';
import {
registerModuleModals,
@ -134,7 +133,6 @@ export async function initializeAuthenticatedFeatures(
const cloudPlanStore = useCloudPlanStore();
const projectsStore = useProjectsStore();
const rolesStore = useRolesStore();
const insightsStore = useInsightsStore();
const bannersStore = useBannersStore();
const versionsStore = useVersionsStore();
const dataTableStore = useDataTableStore();
@ -191,10 +189,6 @@ export async function initializeAuthenticatedFeatures(
});
}
if (insightsStore.isSummaryEnabled) {
void insightsStore.weeklySummary.execute();
}
// Don't check for new versions in preview mode or demo view (ex: executions iframe)
if (!settingsStore.isPreviewMode && routeName !== VIEWS.DEMO) {
void versionsStore.checkForNewVersions();

View File

@ -2,6 +2,7 @@ import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router';
import { VIEWS } from '@/app/constants';
import { useProjectsStore } from './projects.store';
import { getResourcePermissions } from '@n8n/permissions';
import { useInsightsStore } from '@/features/execution/insights/insights.store';
const MainSidebar = async () => await import('@/app/components/MainSidebar.vue');
const WorkflowsView = async () => await import('@/app/views/WorkflowsView.vue');
@ -178,6 +179,14 @@ export const projectsRoutes: RouteRecordRaw[] = [
middleware: ['authenticated'],
},
redirect: '/home/workflows',
beforeEnter: (_to, _from, next) => {
const insightsStore = useInsightsStore();
if (insightsStore.isSummaryEnabled) {
// refresh the weekly summary when entering the home route
void insightsStore.weeklySummary.execute();
}
next();
},
children: commonChildRoutes.map((route, idx) => ({
...route,
name: commonChildRouteExtensions.home[idx].name,

View File

@ -6,6 +6,7 @@ import {
DATA_TABLE_VIEW,
PROJECT_DATA_TABLES,
} from '@/features/core/dataTable/constants';
import { useInsightsStore } from '@/features/execution/insights/insights.store';
const i18n = useI18n();
@ -37,6 +38,14 @@ export const DataTableModule: FrontendModuleDescription = {
meta: {
middleware: ['authenticated', 'custom'],
},
beforeEnter: (_to, _from, next) => {
const insightsStore = useInsightsStore();
if (insightsStore.isSummaryEnabled) {
// refresh the weekly summary when entering the datatables route
void insightsStore.weeklySummary.execute();
}
next();
},
},
{
name: PROJECT_DATA_TABLES,