From 6539f35ad4f785690fa57e340e85de1ac18ba365 Mon Sep 17 00:00:00 2001 From: Matt Keenan Date: Fri, 11 Oct 2024 15:58:04 -0400 Subject: [PATCH] Make test results less jumpy --- src/haz3lweb/app/editors/result/EvalResult.re | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/haz3lweb/app/editors/result/EvalResult.re b/src/haz3lweb/app/editors/result/EvalResult.re index 49e83a155..4516c8036 100644 --- a/src/haz3lweb/app/editors/result/EvalResult.re +++ b/src/haz3lweb/app/editors/result/EvalResult.re @@ -1,5 +1,3 @@ -open Virtual_dom.Vdom; -open Node; open Util; module type Model = { @@ -40,6 +38,7 @@ module Model = { type t = { kind, result, + previous_tests: option(Haz3lcore.TestResults.t) // Stops test results from being cleared on update }; let make_test_report = (model: t): option(Haz3lcore.TestResults.t) => @@ -61,7 +60,7 @@ module Model = { | NoElab => None }; - let init = {kind: Evaluation, result: NoElab}; + let init = {kind: Evaluation, result: NoElab, previous_tests: None}; let test_results = (model: t): option(Haz3lcore.TestResults.t) => switch (model.result) { @@ -79,7 +78,7 @@ module Model = { |> Haz3lcore.TestResults.mk_results, ) | Evaluation(_) - | NoElab => None + | NoElab => model.previous_tests }; let get_elaboration = (model: t): option(Haz3lcore.Exp.t) => @@ -155,6 +154,7 @@ module Update = { result_updated: true, }), } + |> (x => {...x, previous_tests: Model.test_results(x)}) |> Updated.return | (UpdateResult(_), _) => model |> Updated.return_quiet }; @@ -288,6 +288,9 @@ module Selection = { }; module View = { + open Virtual_dom.Vdom; + open Web.Node; + type event = | MakeActive(Selection.t) | JumpTo(Haz3lcore.Id.t);