diff --git a/apps/frontend/src/frontend/view/body/body.gleam b/apps/frontend/src/frontend/view/body/body.gleam index ac20589..d06c3dc 100644 --- a/apps/frontend/src/frontend/view/body/body.gleam +++ b/apps/frontend/src/frontend/view/body/body.gleam @@ -258,7 +258,7 @@ fn popularity_chart(model: Model) { use <- bool.guard(when: list.is_empty(data), return: el.none()) chart.bar_chart("#ff851b", { let acc = Dataset([], []) - use Dataset(dates, value), package <- list.fold_right(data, acc) + use Dataset(dates, value), package <- list.fold(list.reverse(data), acc) case package.popularity { option.None -> Dataset(dates, value) option.Some(popularity) -> { @@ -277,7 +277,7 @@ fn ranked_chart(model: Model) { use <- bool.guard(when: list.is_empty(data), return: el.none()) chart.bar_chart("#ffaff3", { let acc = Dataset([], []) - use Dataset(dates, value), package <- list.fold_right(data, acc) + use Dataset(dates, value), package <- list.fold(list.reverse(data), acc) let label = package.name Dataset([label, ..dates], [package.rank, ..value]) }) diff --git a/packages/lustre/src/lustre/element.gleam b/packages/lustre/src/lustre/element.gleam index 4109ffb..722ab0a 100644 --- a/packages/lustre/src/lustre/element.gleam +++ b/packages/lustre/src/lustre/element.gleam @@ -274,7 +274,7 @@ pub fn fragment(elements: List(Element(msg))) -> Element(msg) { } fn flatten_fragment_elements(elements: List(Element(msg))) { - list.fold_right(elements, [], fn(new_elements, element) { + list.fold(list.reverse(elements), [], fn(new_elements, element) { case element { // Only flatten one level, the runtime handles next level children // alternatively, this could flatten deeply, but it doesn't save