Skip to content

Commit

Permalink
Do not call getAllComponents() in activate
Browse files Browse the repository at this point in the history
Part of #3850

Signed-off-by: David Thompson <davthomp@redhat.com>
  • Loading branch information
datho7561 committed Feb 6, 2024
1 parent eb06f1c commit 9ae98bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ export async function activate(extensionContext: ExtensionContext): Promise<unkn
updateStatusBarItem(crcStatusItem, 'Stop CRC');
void extendClusterExplorer();

await ComponentTypesView.instance.getAllComponents();
await registerKubernetesCloudProvider();
void startTelemetry(extensionContext);
await verifyBinariesInRemoteContainer();
Expand Down
6 changes: 5 additions & 1 deletion src/webview/create-component/createComponentLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { ComponentTypesView } from '../../registriesView';
import sendTelemetry from '../../telemetry';
import { ExtensionID } from '../../util/constants';
import { DevfileConverter } from '../../util/devfileConverter';
import { DevfileV1 } from '../../util/devfileV1Type';
import { Progress } from '../../util/progress';
import { getInitialWorkspaceFolder, selectWorkspaceFolder } from '../../util/workspace';
import {
getDevfileCapabilities,
Expand All @@ -29,7 +31,6 @@ import {
} from '../common-ext/createComponentHelpers';
import { loadWebviewHtml, validateGitURL } from '../common-ext/utils';
import { Devfile, DevfileRegistry, TemplateProjectIdentifier } from '../common/devfile';
import { DevfileV1 } from '../../util/devfileV1Type';

interface CloneProcess {
status: boolean;
Expand All @@ -53,6 +54,9 @@ export default class CreateComponentLoader {
}

static async loadView(title: string, folderPath?: string): Promise<WebviewPanel> {
if (ComponentTypesView.instance.getCompDescriptions().size === 0) {
await Progress.execFunctionWithProgress('Loading available component types...', () => ComponentTypesView.instance.getAllComponents())

Check warning on line 58 in src/webview/create-component/createComponentLoader.ts

View check run for this annotation

Codecov / codecov/patch

src/webview/create-component/createComponentLoader.ts#L58

Added line #L58 was not covered by tests
}
if (CreateComponentLoader.panel) {
CreateComponentLoader.panel.reveal();
return;
Expand Down
4 changes: 4 additions & 0 deletions src/webview/devfile-registry/registryViewLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Odo } from '../../odo/odoWrapper';
import { ComponentTypesView } from '../../registriesView';
import sendTelemetry from '../../telemetry';
import { ExtensionID } from '../../util/constants';
import { Progress } from '../../util/progress';
import { getInitialWorkspaceFolder, selectWorkspaceFolder } from '../../util/workspace';
import { vsCommand } from '../../vscommand';
import { getDevfileCapabilities, getDevfileRegistries, getDevfileTags, isValidProjectFolder, validateName, validatePortNumber } from '../common-ext/createComponentHelpers';
Expand Down Expand Up @@ -155,6 +156,9 @@ export default class RegistryViewLoader {
}

static async loadView(title: string, url?: string): Promise<vscode.WebviewPanel> {
if (ComponentTypesView.instance.getCompDescriptions().size === 0) {
await Progress.execFunctionWithProgress('Loading available component types...', () => ComponentTypesView.instance.getAllComponents())

Check warning on line 160 in src/webview/devfile-registry/registryViewLoader.ts

View check run for this annotation

Codecov / codecov/patch

src/webview/devfile-registry/registryViewLoader.ts#L160

Added line #L160 was not covered by tests
}
const localResourceRoot = vscode.Uri.file(path.join(RegistryViewLoader.extensionPath, 'out', 'devfileRegistryViewer'));
if (panel) {
if (RegistryViewLoader.url !== url) {
Expand Down

0 comments on commit 9ae98bd

Please sign in to comment.