Skip to content

Commit

Permalink
ensure selected run is preserved between sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
justintucker1 committed Oct 30, 2024
1 parent a59ee73 commit 630b37b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/viewProviders/RokuAutomationViewViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider {
super(context, dependencies);

this.addMessageCommandCallback(ViewProviderCommand.storeRokuAutomationConfigs, async (message) => {
this.selectedConfig = message.context.selectedConfig;
this.rokuAutomationConfigs = message.context.configs;
// Make sure to use JSON.stringify or weird stuff happens
await context.workspaceState.update(WorkspaceStateKey.rokuAutomationConfigs, JSON.stringify(message.context));
Expand Down Expand Up @@ -87,6 +88,7 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider {
}

private isRecording = false;
private selectedConfig;
private rokuAutomationConfigs: {
name: string;
steps: {
Expand Down Expand Up @@ -153,10 +155,12 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider {
const json = this.extensionContext.workspaceState.get(WorkspaceStateKey.rokuAutomationConfigs);
if (typeof json === 'string') {
const result = JSON.parse(json);
this.selectedConfig = result.selectedConfig;
this.rokuAutomationConfigs = result.configs;
}

const message = this.createEventMessage(ViewProviderEvent.onRokuAutomationConfigsLoaded, {
selectedConfig: this.selectedConfig,
configs: this.rokuAutomationConfigs
});

Expand Down

0 comments on commit 630b37b

Please sign in to comment.