From d3c3e2e31bdabeadec678a3236cf7fa7e7cebcd4 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Mon, 11 May 2020 21:33:20 +0200 Subject: [PATCH] preserving item displaying details on page refresh (#19) fixes #18 --- src/ElasticSearch.elm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ElasticSearch.elm b/src/ElasticSearch.elm index b997e41..4ea676b 100644 --- a/src/ElasticSearch.elm +++ b/src/ElasticSearch.elm @@ -126,15 +126,16 @@ update path navKey msg model = ) ShowDetails selected -> - ( { model - | showDetailsFor = - if model.showDetailsFor == Just selected then - Nothing + ( model + , createUrl path + model.query + (if model.showDetailsFor == Just selected then + Nothing - else - Just selected - } - , Cmd.none + else + Just selected + ) + |> Browser.Navigation.pushUrl navKey )