Skip to content

Commit

Permalink
pre-seed all variables/features/envs before refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotCamblor committed Jul 31, 2023
1 parent cb8cdfc commit 036fa1f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/cli/cliUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ export type CombinedVariableData = {
configurations?: FeatureConfigurationWithEnvNames[]
}

export const initStorage = async () => {
await Promise.all([getAllVariables(), getAllFeatures(), getAllEnvironments()])
}

export const getCombinedVariableDetails = async (
variable: string | Variable,
) => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/UsagesTreeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import {
JSONMatch,
VariableReference,
getAllVariables,
getAllEnvironments,
getCombinedVariableDetails,
CombinedVariableData,
getOrganizationId,
getAllFeatures,
} from '../cli'

import { showBusyMessage, hideBusyMessage } from './statusBarItem'
Expand Down Expand Up @@ -44,7 +46,7 @@ export class UsagesTreeProvider

private async getCombinedAPIData() {
showBusyMessage('Fetching devcycle data')
const variables = await getAllVariables()
const [variables] = await Promise.all([getAllVariables(), getAllFeatures(), getAllEnvironments()])
const result = {} as Record<string, VariableCodeReference>
await Promise.all(
Object.entries(variables).map(async ([key, variable]) => {
Expand Down
3 changes: 1 addition & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;('use strict')
import * as vscode from 'vscode'
import { KEYS, StateManager } from './StateManager'
import { init, login, logout, status as cliStatus, initStorage } from './cli'
import { init, login, logout, status as cliStatus } from './cli'
import { CLIENT_KEYS, SecretStateManager } from './SecretStateManager'
import { loadConfig, autoLoginIfHaveCredentials } from './utils/credentials'
import { SidebarProvider } from './components/SidebarProvider'
Expand All @@ -21,7 +21,6 @@ export const activate = async (context: vscode.ExtensionContext) => {
SecretStateManager.init(context)
StateManager.globalState = context.globalState
StateManager.workspaceState = context.workspaceState
StateManager.clearState()
const autoLogin = vscode.workspace
.getConfiguration('devcycle-featureflags')
.get('loginOnWorkspaceOpen')
Expand Down

0 comments on commit 036fa1f

Please sign in to comment.