chore(editor): Making health call only if custom hosted templates (#16686)

This commit is contained in:
Nikhil Kuriakose
2025-06-25 11:23:32 +02:00
committed by GitHub
parent 6edde7fb66
commit 6fa4a3eaa1
3 changed files with 5 additions and 10 deletions

View File

@@ -137,7 +137,6 @@ describe('Init', () => {
it('should not init authenticated features if user is not logged in', async () => { it('should not init authenticated features if user is not logged in', async () => {
const cloudStoreSpy = vi.spyOn(cloudPlanStore, 'initialize'); const cloudStoreSpy = vi.spyOn(cloudPlanStore, 'initialize');
const templatesTestSpy = vi.spyOn(settingsStore, 'testTemplatesEndpoint');
const sourceControlSpy = vi.spyOn(sourceControlStore, 'getPreferences'); const sourceControlSpy = vi.spyOn(sourceControlStore, 'getPreferences');
const nodeTranslationSpy = vi.spyOn(nodeTypesStore, 'getNodeTranslationHeaders'); const nodeTranslationSpy = vi.spyOn(nodeTypesStore, 'getNodeTranslationHeaders');
vi.mocked(useUsersStore).mockReturnValue({ currentUser: null } as ReturnType< vi.mocked(useUsersStore).mockReturnValue({ currentUser: null } as ReturnType<
@@ -146,14 +145,12 @@ describe('Init', () => {
await initializeAuthenticatedFeatures(); await initializeAuthenticatedFeatures();
expect(cloudStoreSpy).not.toHaveBeenCalled(); expect(cloudStoreSpy).not.toHaveBeenCalled();
expect(templatesTestSpy).not.toHaveBeenCalled();
expect(sourceControlSpy).not.toHaveBeenCalled(); expect(sourceControlSpy).not.toHaveBeenCalled();
expect(nodeTranslationSpy).not.toHaveBeenCalled(); expect(nodeTranslationSpy).not.toHaveBeenCalled();
}); });
it('should init authenticated features only once if user is logged in', async () => { it('should init authenticated features only once if user is logged in', async () => {
const cloudStoreSpy = vi.spyOn(cloudPlanStore, 'initialize'); const cloudStoreSpy = vi.spyOn(cloudPlanStore, 'initialize');
const templatesTestSpy = vi.spyOn(settingsStore, 'testTemplatesEndpoint');
const sourceControlSpy = vi.spyOn(sourceControlStore, 'getPreferences'); const sourceControlSpy = vi.spyOn(sourceControlStore, 'getPreferences');
const nodeTranslationSpy = vi.spyOn(nodeTypesStore, 'getNodeTranslationHeaders'); const nodeTranslationSpy = vi.spyOn(nodeTypesStore, 'getNodeTranslationHeaders');
vi.mocked(useUsersStore).mockReturnValue({ currentUser: { id: '123' } } as ReturnType< vi.mocked(useUsersStore).mockReturnValue({ currentUser: { id: '123' } } as ReturnType<
@@ -163,7 +160,6 @@ describe('Init', () => {
await initializeAuthenticatedFeatures(); await initializeAuthenticatedFeatures();
expect(cloudStoreSpy).toHaveBeenCalled(); expect(cloudStoreSpy).toHaveBeenCalled();
expect(templatesTestSpy).toHaveBeenCalled();
expect(sourceControlSpy).toHaveBeenCalled(); expect(sourceControlSpy).toHaveBeenCalled();
expect(nodeTranslationSpy).toHaveBeenCalled(); expect(nodeTranslationSpy).toHaveBeenCalled();

View File

@@ -121,12 +121,6 @@ export async function initializeAuthenticatedFeatures(
} }
} }
if (settingsStore.isTemplatesEnabled) {
try {
await settingsStore.testTemplatesEndpoint();
} catch (e) {}
}
if (rootStore.defaultLocale !== 'en') { if (rootStore.defaultLocale !== 'en') {
await nodeTypesStore.getNodeTranslationHeaders(); await nodeTypesStore.getNodeTranslationHeaders();
} }

View File

@@ -301,6 +301,11 @@ onMounted(async () => {
restoreSearchFromRoute(); restoreSearchFromRoute();
// Check if templates are enabled and check if the local templates store is available
if (settingsStore.isTemplatesEnabled) {
settingsStore.testTemplatesEndpoint().catch(() => {});
}
setTimeout(() => { setTimeout(() => {
// Check if there is scroll position saved in route and scroll to it // Check if there is scroll position saved in route and scroll to it
const scrollOffset = route.meta?.scrollOffset; const scrollOffset = route.meta?.scrollOffset;