Skip to content

Commit

Permalink
table: refactor cleanup functions
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Apr 21, 2024
1 parent 6880df2 commit d848f95
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/brr_lwd_ui/table/virtual_table.ml
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ let make (type data) ~(ui_table : Schema.fixed_row_height)
in
let _ =
let open Fut.Result_syntax in
let () = Int_uniqueue.clear unload_queue in
let () =
(* Cleanup *)
Lwd_table.clear table;
Hashtbl.clear row_index;
Int_uniqueue.clear unload_queue
in
let+ total = total_items in
if not (Lwd.peek num_rows = total) then Lwd.set num_rows total;
Lwd_table.clear table;
Hashtbl.clear row_index;
Int_uniqueue.clear unload_queue;
for i = 0 to total - 1 do
let set = { index = i; content = None; render } in
Hashtbl.add row_index i @@ Lwd_table.append ~set table
Expand Down

0 comments on commit d848f95

Please sign in to comment.