Skip to content

Commit 97a4d18

Browse files
committed
Preserve :search-text on history-push
1 parent 96bbfc1 commit 97a4d18

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/portal/ui/state.cljs

+10-1
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,22 @@
143143
(assoc-in state [:expanded? {:stable-path [] :value value}] n)
144144
state))
145145

146+
(defn- push-search-text [state {:keys [context] :portal/keys [value]}]
147+
(let [location (get-location context)
148+
search-text (get-in state [:search-text location])]
149+
(assoc state
150+
:search-text
151+
(if-not search-text
152+
{}
153+
{{:value value :stable-path []} search-text}))))
154+
146155
(defn history-push [state {:portal/keys [key value f] :as entry}]
147156
(-> (push-command state entry)
148157
(assoc
149158
:portal/previous-state state
150159
:portal/key key
151160
:portal/f f
152161
:portal/value value
153-
:search-text {}
154162
:selected (mapv
155163
(fn [context]
156164
(-> context
@@ -161,6 +169,7 @@
161169
:alt-bg true)))
162170
(:selected state)))
163171
(dissoc :portal/next-state)
172+
(push-search-text entry)
164173
(push-viewer entry)
165174
(push-expanded entry)))
166175

0 commit comments

Comments
 (0)