You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I experimented with "cascading entity pickers". Chosing one picker value loads other picker options, like Invoice line items in Fulcro RAD demo. In demo changing category (eg Toys), calls picker-options/load-options! and prepares subselection of items. Another example would be selecting User Account could provide list of available addresses for Address picker. I do not know if "cascading entity pickers" is correct term, but you got the picture. Changing one value will trigger picker-options/load-options! from :on-change form trigger.
In my application when user selects "Location", I query an external system for list of resources available at the location. The external system is kind of slow. So what I noticed is that the option cache is not utilized and options are always reloaded.
Result of picker options load is stored in ::picker-options/options-cache. I investigated the issue and found that option cache values contain :cached-at, :options and :query-result keys. While all other standard options were loaded correctly (think all-accounts and all-categories in fulcro-demo new invoice example), my picker options loaded later were missing :cached-at.
You can confirm the behavior in Fulcro Demo "New invoice" form. After changing Category, new item in option-cache is missing :cached-at. Here is a screenshot from Fulcro Inspect:
What I found is that load-picker-options! correctly sets the timestamp
And the change is visible in Fulcro Inspect DB history. Then later this record disappears. Probably during merging the result of load? When :post-action hook is invoked, it receives a state where its option-cache contains only :query-result. It adds transformed option, but :cached-at timestamp is lost.
I think setting timestamp before reloading is correct place, because it prevents multiple requests when the picker is reused multiple times on the page. But why is cached-options removed is beyond my knowledge of Fulcro (RAD) internals. I cannot even guess if it is a bug or expected behavior and result of load implementation.
What I would suggest is to assoc timestamp once more at the end of :post-action.
Probably a bug...I haven't had time to dig into this, but yes if the load includes the item in the query without a :ui/... namespace then merge will remove it (since the server won't respond with it).
What do the network exchanges look like? Is the cached-at going with the query?
I experimented with "cascading entity pickers". Chosing one picker value loads other picker options, like Invoice line items in Fulcro RAD demo. In demo changing category (eg Toys), calls
picker-options/load-options!
and prepares subselection of items. Another example would be selecting User Account could provide list of available addresses for Address picker. I do not know if "cascading entity pickers" is correct term, but you got the picture. Changing one value will triggerpicker-options/load-options!
from:on-change
form trigger.In my application when user selects "Location", I query an external system for list of resources available at the location. The external system is kind of slow. So what I noticed is that the option cache is not utilized and options are always reloaded.
Result of picker options load is stored in
::picker-options/options-cache
. I investigated the issue and found that option cache values contain:cached-at
,:options
and:query-result
keys. While all other standard options were loaded correctly (think all-accounts and all-categories in fulcro-demo new invoice example), my picker options loaded later were missing:cached-at
.You can confirm the behavior in Fulcro Demo "New invoice" form. After changing Category, new item in option-cache is missing
:cached-at
. Here is a screenshot from Fulcro Inspect:What I found is that
load-picker-options!
correctly sets the timestampfulcro-rad/src/main/com/fulcrologic/rad/picker_options.cljc
Line 81 in ba17f5d
And the change is visible in Fulcro Inspect DB history. Then later this record disappears. Probably during merging the result of load? When
:post-action
hook is invoked, it receives a state where its option-cache contains only:query-result
. It adds transformed option, but:cached-at
timestamp is lost.I think setting timestamp before reloading is correct place, because it prevents multiple requests when the picker is reused multiple times on the page. But why is cached-options removed is beyond my knowledge of Fulcro (RAD) internals. I cannot even guess if it is a bug or expected behavior and result of load implementation.
What I would suggest is to assoc timestamp once more at the end of
:post-action
.fulcro-rad/src/main/com/fulcrologic/rad/picker_options.cljc
Line 94 in ba17f5d
I can provide a pull request, but without further knowledge it would be only treating symptoms, not the root cause.
The text was updated successfully, but these errors were encountered: