WSSCode Blog

Pathom Updates 8, Babashka support and Embed visualizations

March 06, 2021

Babashka Support

Babashka environment is now supported by Pathom 3!

This means you can now use the Pathom engine to run fast scripts!

This is the work involved to make this happen:

In the process, we gained a few bonuses:

One limitation is around Smart Maps, not possible at this moment in Babashka, but this may change.

☝️ Just got merged today while I was writing this post. I’m going to be checking about it soon!

You can follow the Pathom side of it at https://github.com/wilkerlucio/pathom3/issues/22.

Also, you can find a complete example using Pathom 3 and Babashka here.

Pathom Viz

Let’s talk about some changes in Pathom Viz now.

Improvements

Pathom Viz now uses the clojure-mode for the EDN view sections. The difference is that this uses CodeMirror 6, and this implementation is much nicer. The real difference is that this mode has good support for folding, which helps navigate large data structures.

I also made some improvements to the minimum element sizes. Many things in Pathom Viz are resizable. Sometimes the panels would go missing for being so small when changing screen sizes or opening new elements. Now everything has a bigger minimum size, which will prevent elements from going missing.

Embed

If you like to integrate something with Pathom Viz, there is a way with minimal effort required. Kind of like how you embed a Youtube video on a page, you can now use an iframe to embed a Pathom Visualization in a web renderer.

To give a quick demo, here is a planner explorer embed on this blog:

This is the same demo used in the Pathom 3 Planner docs.

Using Pathom Viz Embed is easy as adding an iframe to your page. You can reproduce the previous example by using the following HTML snippet:

<iframe src="https://pathom-viz.wsscode.com/embed.html?msg=%7B%3Apathom.viz.embed%2Fcomponent-name%0A%20%3Apathom.viz.embed.component%2Fplanner-explorer%0A%0A%20%3Apathom.viz.embed%2Fcomponent-props%0A%20%7B%3Acom.wsscode.pathom3.connect.indexes%2Findex-oir%0A%20%20%7B%3Aa%20%7B%7B%7D%20%23%7Ba%7D%7D%0A%20%20%20%3Ab%20%7B%7B%3Ag%20%7B%7D%7D%20%23%7Bb%7D%7D%0A%20%20%20%3Ac%20%7B%7B%7D%20%23%7Bc%7D%7D%0A%20%20%20%3Ae%20%7B%7B%7D%20%23%7Be%20e1%7D%7D%0A%20%20%20%3Af%20%7B%7B%3Ae%20%7B%7D%7D%20%23%7Bf%7D%7D%0A%20%20%20%3Ag%20%7B%7B%3Ac%20%7B%7D%20%3Af%20%7B%7D%7D%20%23%7Bg%7D%7D%0A%20%20%20%3Ah%20%7B%7B%3Aa%20%7B%7D%20%3Ab%20%7B%7D%7D%20%23%7Bh%7D%7D%7D%0A%0A%20%20%3Aedn-query-language.core%2Fquery%0A%20%20%5B%3Ah%5D%7D%7D" />

As you can see, the idea is to send the data via URL. This approach is cool and easy, but there is a limit to the URL size, and some data can go way over it.

To handle big data chunks, you can use postMessage to send the data to the embed, learn more about it in the Pathom Viz Embed Docs.

Resolve mutation params

There is a new built-in plugin in town, the resolve-mutations-params. This plugin will make mutation params behave similarly to inputs. Pathom will try to auto-resolve them based on the initial mutation params.

Next step: Dynamic Resolvers

My next priority for Pathom 3 is to work on dynamic resolvers.

Dynamic resolvers are a special kind of resolver. They allow for efficient implementation for things like GraphQL, Datomic, SQL, and Pathom to Pathom integrations.

I’ll talk more about then after I figure a nice API for it. For now, I like to say that GraphQL and Datomic integrations will be the next prominent features you will see arriving in Pathom 3!

After dynamic resolvers, I think it will be time for Pathom to enter the Beta stage.

This stage will be mostly to catch bugs, but you can expect new features as well. The biggest one that’s certainly planned is the parallel runner.

Github Projects

From now on, I’ll use Github Projects feature to manage tasks in Pathom and other of my projects.

I hope you can all join these projects and collaborate. You can give ideas, criticism, vote on tasks you like to see implemented.

Check those at:


Support my work

I'm currently an independent developer and I spent quite a lot of my personal time doing open-source work. If my work is valuable for you or your company, please consider supporting my work though Patreon, this way you can help me have more available time to keep doing this work. Thanks!

Current supporters

And here I like to give a thanks to my current supporters: