Hi there - is it possible for portal to automatically datafy items before rendering, or have an option for such? I am trying out portal to navigate through an example employee->manager data structure, and it works so long as I do ctrl-shift-p and execute "clojure.core/datafy" after I click into the "id" element of each employee...
Admittedly that may be an artefact of the way datafy and nav was used in the example I working from .... https://gist.github.com/sashton/56a14d275c71d7ce3e224c11c9a16bd4 .... where the nav metadata is added on datafying a user map.
No ... starting to think that this is the way datafy and nav are intended to be used.... Given that datafying something that hasn't implemented Datifiable protocol just returns itself (e.g. (datafy 1) => 1
etc ..) is there any harm in always calling datafy before rendering?
Hi @apbleonard, portal previously did auto datafy values before rendering but what I realized is that while it is convenient, it made it hard to work with objects directly
I feel like I should make it possible to opt-in to this behavior, just not sure how :thinking_face:
@djblue I noticed a recent change to call datafy inside on-nav for the pwa nav demo recently? https://github.com/djblue/portal/commit/c7beb3468733f17d337bda8f6b83d6ee77f81a09 , but not sure if this is work in progress...
BTW A keyboard shortcut to call datafy would be a workaround for now - is there a way of doing that beyond forking?
@djblue Ok .... I think I see now... The example code I was using added nav metadata on datafying. By changing it to add the nav metadata to the resolved object on nav-ing, portal now navigates fine with no need to datafy at any point :thumbsup: I guess that's the power of having the nav protocol free for us as users to do what we want in our context, and you don't have to care 🙂
Ohh, yeah. I always prefer nav-ing, I didn't realize that was the problem. I do think when to datafy is still a problem, but I'm glad you could get past it 😄
Thanks for portal by the way. Looking forward to using it more 🎯