From ab159238ddb27a3a2d1ea228b2dd23a4e19694f6 Mon Sep 17 00:00:00 2001 From: "Stijn (\"stain\") Seghers" Date: Tue, 30 May 2023 14:42:22 +0200 Subject: [PATCH] Run IDE with Project Manager endpoint instead of Language Server endpoints, when on local backend (#6810) This is a fix for a couple of recent regressions: - Fixes #6756: Projects couldn't be renamed anymore from within the project view. - Fixes #6804: One could no longer switch between projects from within the project view. - It also unblocks the issue with the spinner (that got reverted), but that probably needs some extra attention. It might be the long-term goal to have different UX solutions to these cases, but this should fix those regressions in the short term at least. Thanks to @somebody1234 for the in-depth conversation (and the actual code!). --- .../src/dashboard/components/dashboard.tsx | 1 + .../src/dashboard/components/ide.tsx | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/dashboard.tsx b/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/dashboard.tsx index 6e3963522f2..a80df57b0bd 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/dashboard.tsx +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/dashboard.tsx @@ -299,6 +299,7 @@ function Dashboard(props: DashboardProps) { const switchToDashboardTab = react.useCallback(() => { setTab(Tab.dashboard) + doRefresh() const ideElement = document.getElementById(IDE_ELEMENT_ID) if (ideElement) { ideElement.style.top = '-100vh' diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/ide.tsx b/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/ide.tsx index 04e4b9bffab..6ab04d7ffa5 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/ide.tsx +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/ide.tsx @@ -4,6 +4,8 @@ import * as react from 'react' import * as backendModule from '../backend' import * as backendProvider from '../../providers/backend' +import GLOBAL_CONFIG from '../../../../../../../../gui/config.yaml' assert { type: 'yaml' } + // ================= // === Constants === // ================= @@ -67,6 +69,15 @@ function Ide(props: IdeProps) { } })() const runNewProject = async () => { + const engineConfig = + backend.type === backendModule.BackendType.remote + ? { + rpcUrl: jsonAddress, + dataUrl: binaryAddress, + } + : { + projectManagerUrl: GLOBAL_CONFIG.projectManagerEndpoint, + } await appRunner.runApp({ loader: { assetsUrl: `${assetsRoot}dynamic-assets`, @@ -74,8 +85,7 @@ function Ide(props: IdeProps) { jsUrl: `${assetsRoot}pkg${JS_EXTENSION[backend.type]}`, }, engine: { - rpcUrl: jsonAddress, - dataUrl: binaryAddress, + ...engineConfig, preferredVersion: engineVersion, }, startup: {