Skip to content
Snippets Groups Projects
Commit 6ce36f5e authored by Michele Alberti's avatar Michele Alberti
Browse files

[ivette] Fix ASTinfo behavior on server stop/reset.

parent 7d945bce
No related branches found
No related tags found
No related merge requests found
......@@ -79,19 +79,19 @@ const ASTinfo = () => {
const buffer = React.useMemo(() => new RichTextBuffer(), []);
const [select, setSelect] = States.useSelection();
const marker = select && select.marker;
const data = States.useRequest('kernel.ast.info', marker || '');
const data = States.useRequest('kernel.ast.info', marker);
React.useEffect(() => {
buffer.clear();
if (data) {
buffer.clear();
parseInfo(buffer, data);
}
}, [buffer, data]);
// Callbacks
function onSelection(mark: any) {
function onSelection(name: string) {
// For now, the only markers are functions.
setSelect({ function: mark });
setSelect({ function: name });
}
// Component
......
......@@ -33,7 +33,7 @@ const PP = new Dome.PP('AST View');
// --- Rich Text Printer
// --------------------------------------------------------------------------
const printAST = (buffer: any, text: string) => {
const printAST = (buffer: RichTextBuffer, text: string) => {
if (Array.isArray(text)) {
const tag = text.shift();
if (tag !== '') {
......@@ -48,7 +48,9 @@ const printAST = (buffer: any, text: string) => {
}
};
async function loadAST(buffer: any, theFunction?: string, theMarker?: string) {
async function loadAST(
buffer: RichTextBuffer, theFunction?: string, theMarker?: string,
) {
buffer.clear();
if (theFunction) {
buffer.log('// Loading', theFunction, '');
......@@ -124,7 +126,6 @@ const ASTview = () => {
}
// Theme Popup
const selectTheme = (id?: string) => id && setTheme(id);
const checkTheme =
(th: { id: string }) => ({ checked: th.id === theme, ...th });
......
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