From a3ed2036cbe4f1b7cb69acf8e730daa7b6471780 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Thu, 9 Jul 2020 18:15:34 +0200 Subject: [PATCH] don't show spinner when empty query is submitted (#128) --- src/Search.elm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Search.elm b/src/Search.elm index 87504f8..7fa4487 100644 --- a/src/Search.elm +++ b/src/Search.elm @@ -352,16 +352,20 @@ update path navKey result_type options decodeResultItemSource msg model = ) QueryInputSubmit -> - ( { model | result = RemoteData.Loading } - , createUrl - path - model.channel - model.query - model.show - 0 - model.size - |> Browser.Navigation.pushUrl navKey - ) + if model.query == Nothing || model.query == Just "" then + ( model, Cmd.none ) + + else + ( { model | result = RemoteData.Loading } + , createUrl + path + model.channel + model.query + model.show + 0 + model.size + |> Browser.Navigation.pushUrl navKey + ) QueryResponse result -> ( { model | result = result }