From 6ce36f5ed653723e158cd56c0aa7c2bbd8f6401e Mon Sep 17 00:00:00 2001 From: Michele Alberti <michele.alberti@cea.fr> Date: Wed, 27 May 2020 09:52:46 +0200 Subject: [PATCH] [ivette] Fix ASTinfo behavior on server stop/reset. --- ivette/src/renderer/ASTinfo.tsx | 8 ++++---- ivette/src/renderer/ASTview.tsx | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ivette/src/renderer/ASTinfo.tsx b/ivette/src/renderer/ASTinfo.tsx index 0416b0cd63f..413b6c99d55 100644 --- a/ivette/src/renderer/ASTinfo.tsx +++ b/ivette/src/renderer/ASTinfo.tsx @@ -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 diff --git a/ivette/src/renderer/ASTview.tsx b/ivette/src/renderer/ASTview.tsx index b308be9465a..80b33c5760b 100644 --- a/ivette/src/renderer/ASTview.tsx +++ b/ivette/src/renderer/ASTview.tsx @@ -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 }); -- GitLab