Fork me on GitHub
#fulcro
<
2021-11-03
>
cjmurphy22:11:39

I'm calling picker-options/load-options! pretty much just like in the RAD demo: (picker-options/load-options! fulcro-app cls props organisation.attribs/tzone). It doesn't always seem to be hitting the server, presumably b/c it is just getting the TZ values from the cache (from the doc string: "so calling this function may do little more than link your component to an existing cached value of options"). I'm using it where definitely want to go to the server (country has changed locally and the TZ resolver has a param of country to retrieve only the TZs of that country). Is there a way of invalidating the cache whilst (or just before) calling this function?

tony.kay01:11:07

It's just app state...you can do what you like. Pickers have a cache time

cjmurphy06:11:37

I was looking to have the cache be invalidated when the params change, and actually found an example in the RAD demo (forgive the formatting):

::picker-options/cache-key        
(fn [_ {:line-item/keys [id] :as props}]                                                                                 (keyword "item-list" (or                                                                                                     (some-> props :line-item/category :category/id str)                                                                             "all")))
So that should do the job nicely.