Skip to content
Snippets Groups Projects
Commit 25e7342e authored by Loïc Correnson's avatar Loïc Correnson
Browse files

Merge branch 'fix/ivette/project-states' into 'master'

[ivette] Fixes states requests at launch.

Closes #1208

See merge request frama-c/frama-c!4055
parents 6b4ed04e f375ece8
No related branches found
No related tags found
No related merge requests found
...@@ -40,10 +40,7 @@ import { getCurrent, setCurrent } from 'frama-c/kernel/api/project'; ...@@ -40,10 +40,7 @@ import { getCurrent, setCurrent } from 'frama-c/kernel/api/project';
import * as Ast from 'frama-c/kernel/api/ast'; import * as Ast from 'frama-c/kernel/api/ast';
import * as Server from './server'; import * as Server from './server';
/* Name of the default Frama-C project. */ const CurrentProject = new GlobalState<string>("");
const defaultProject = 'default';
const CurrentProject = new GlobalState<string>(defaultProject);
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// --- Pretty Printing (Browser Console) // --- Pretty Printing (Browser Console)
...@@ -57,7 +54,7 @@ const D = new Dome.Debug('States'); ...@@ -57,7 +54,7 @@ const D = new Dome.Debug('States');
Server.onReady(async () => { Server.onReady(async () => {
try { try {
CurrentProject.setValue(defaultProject); CurrentProject.setValue("");
const { id } = await Server.send(getCurrent, null); const { id } = await Server.send(getCurrent, null);
CurrentProject.setValue(id); CurrentProject.setValue(id);
} catch (error) { } catch (error) {
...@@ -66,7 +63,7 @@ Server.onReady(async () => { ...@@ -66,7 +63,7 @@ Server.onReady(async () => {
}); });
Server.onShutdown(() => { Server.onShutdown(() => {
CurrentProject.setValue(defaultProject); CurrentProject.setValue("");
}); });
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -146,7 +143,7 @@ export function useRequest<In, Out>( ...@@ -146,7 +143,7 @@ export function useRequest<In, Out>(
}; };
async function trigger(): Promise<void> { async function trigger(): Promise<void> {
if (project && rq && params !== undefined) { if (project !== "" && rq && params !== undefined) {
try { try {
update(options.pending); update(options.pending);
const r = await Server.send(rq, params); const r = await Server.send(rq, params);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment