Fork me on GitHub

How do I properly solve the following? I have a search box and a list of entities (local, just an array of constants). I'd like to display a list of matching entities when contents of search box change, where matching is complicated (case-sensitivity, alternate names, g and ġ are the same, å and aa are the same – all the typical cornucopia of manual data entry).


Should I make it a subscription?


Something along the lines of (re-frame/reg-sub :matching (fn [db] (do-the-complicated-match (:search-string db)))). Will that only be invoked once per change in (:search-string db)?


@dottedmag I would have an entry in my app-db called :filtered-list (which I can subscribe to), which was updated to reflect the search when I dispatch the search phrase to the appropriate handler OR use a component that subscribes to the whole list and create the search result as component local state.


I've been reading the excellent doc on re-frame-async-flow-fx. I'm curious that though the example mentions websockets it seems to imply that re-frame-async-flow-fx is for initialization and should be cleaned up when that phase is over. However, I'm thinking of a websocket that stays open for the life of the session... is this envisioned in re-frame-async-flow-fx as well?