Skip to content

Commit

Permalink
Fix load-more button state
Browse files Browse the repository at this point in the history
  • Loading branch information
eikek committed Jun 3, 2022
1 parent b50f57f commit cfc9034
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions modules/webapp/src/main/elm/Data/Items.elm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module Data.Items exposing
, first
, flatten
, idSet
, isEmpty
, length
, nonEmpty
, replaceIn
, unwrapGroups
)
Expand All @@ -23,6 +25,16 @@ import Set exposing (Set)
import Util.List


isEmpty : ItemLightList -> Bool
isEmpty list =
List.all (.items >> List.isEmpty) list.groups


nonEmpty : ItemLightList -> Bool
nonEmpty list =
not (isEmpty list)


flatten : ItemLightList -> List ItemLight
flatten list =
List.concatMap .items list.groups
Expand Down
4 changes: 2 additions & 2 deletions modules/webapp/src/main/elm/Page/Search/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ update texts bookmarkId lastViewedItemId env msg model =
{ model
| searchInProgress = False
, searchOffset = noff
, moreAvailable = list.groups /= []
, moreAvailable = Data.Items.nonEmpty list
}
in
makeResult env.selectedItems <|
Expand All @@ -233,7 +233,7 @@ update texts bookmarkId lastViewedItemId env msg model =
| searchInProgress = False
, moreInProgress = False
, searchOffset = noff
, moreAvailable = list.groups /= []
, moreAvailable = Data.Items.nonEmpty list
}
in
update texts bookmarkId lastViewedItemId env (ItemCardListMsg (Comp.ItemCardList.AddResults list)) m
Expand Down

0 comments on commit cfc9034

Please sign in to comment.