Fork me on GitHub
#portal
<
2022-02-07
>
sakalli08:02:57

Hello, has anyone here used Portal on a shadow project? Any pointers on how to get things to play nice? for instance, automatically reloading portal (cljs) when reloading and so forth?

djblue19:02:55

The portal.web namespace should work fine with shadow. Not sure what automatically reloading portal when reloading means :thinking_face: Can you provide more info?

sakalli07:02:02

Sorry I was unclear. What I meant was, for example, what is the recommended setup to maintain the portal connection working following browser runtime reloads/restarts. Perhaps this is more of a shadow question.

djblue16:02:57

If you are using portal.web, the tap> s are stored as part of the browser runtime which means they disappear when you reload the web page. If you want the values to persist across page reloads, you can try the https://github.com/djblue/portal#remote-api. You will need to coordinate the :port , but that is easily hard coded. The main limitation is you can only tap> serializable values to a remote portal.

👍 1
xceno19:02:48

@U0FMV3MDK I use this code and add it as a shadow-cljs :preload. It'll automatically set things up for you, using portals remote-api.

sakalli19:02:41

ah, this is great. thanks @U012ADU90SW ❤️