portal

https://github.com/djblue/portal
apbleonard 2021-01-04T14:13:05.098300Z

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...

apbleonard 2021-01-04T14:17:24.098400Z

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.

apbleonard 2021-01-04T15:29:20.098600Z

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?

djblue 2021-01-04T18:37:31.099800Z

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

djblue 2021-01-04T18:39:15.100Z

I feel like I should make it possible to opt-in to this behavior, just not sure how :thinking_face:

apbleonard 2021-01-04T22:59:13.101100Z

@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...

apbleonard 2021-01-04T23:01:23.101300Z

BTW A keyboard shortcut to call datafy would be a workaround for now - is there a way of doing that beyond forking?

apbleonard 2021-01-04T23:13:48.101500Z

@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 🙂

djblue 2021-01-04T23:47:53.101700Z

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 😄

apbleonard 2021-01-04T23:57:07.102Z

Thanks for portal by the way. Looking forward to using it more 🎯