Skip to content

Commit

Permalink
Make test results less jumpy
Browse files Browse the repository at this point in the history
  • Loading branch information
Negabinary committed Oct 11, 2024
1 parent 0d6d6c3 commit 6539f35
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/haz3lweb/app/editors/result/EvalResult.re
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
open Virtual_dom.Vdom;
open Node;
open Util;

module type Model = {
Expand Down Expand Up @@ -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) =>
Expand All @@ -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) {
Expand All @@ -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) =>
Expand Down Expand Up @@ -155,6 +154,7 @@ module Update = {
result_updated: true,
}),
}
|> (x => {...x, previous_tests: Model.test_results(x)})
|> Updated.return
| (UpdateResult(_), _) => model |> Updated.return_quiet
};
Expand Down Expand Up @@ -288,6 +288,9 @@ module Selection = {
};

module View = {
open Virtual_dom.Vdom;
open Web.Node;

type event =
| MakeActive(Selection.t)
| JumpTo(Haz3lcore.Id.t);
Expand Down

0 comments on commit 6539f35

Please sign in to comment.