I've come across a situation with lazy model loading not updating simple hydration functions.
Define three models (user, permissions, company)
The company model definition defines a simple hydration for users (in the same company.clj file).
The user model definition defines a simple hydration fo permissions (in the same user.clj file).
In the main execution path, we can select a single company, then invoke hydrate for users. The users model will be lazily loaded and hydrated. Awesome.
During the loading of users, a new ^:hydration function is loaded for the permissions. Unfortunately, the simple hydration method has already realized the delay; and thus doesn't know of the new permissions hydration function.
The fix I've come across is to put hydrations into a seperate file and ensure it's required by what needs it. This however feels counter intuitive when models can be resolved when required.
When a model is resolved (in toucan.db/resolve-model-from-symbol), the delays could be converted to an atom and reset! or at least set! back to a delay
I've come across a situation with lazy model loading not updating simple hydration functions.
user
,permissions
,company
)company
model definition defines a simple hydration for users (in the samecompany.clj
file).user
model definition defines a simple hydration fopermissions
(in the sameuser.clj
file).In the main execution path, we can select a single
company
, then invoke hydrate for users. Theusers
model will be lazily loaded and hydrated. Awesome.During the loading of users, a new
^:hydration
function is loaded for thepermissions
. Unfortunately, the simple hydration method has already realized thedelay
; and thus doesn't know of the newpermissions
hydration function.The fix I've come across is to put hydrations into a seperate file and ensure it's required by what needs it. This however feels counter intuitive when models can be resolved when required.
Thoughts?