releases

A place to post minor releases of libraries and projects that you would not otherwise post in #announcements
2021-05-18T20:15:05.002Z

New release of Inertia-clojure v0.2.1, Clojure middleware for Inertia.js to build single-page apps, without building an API. https://github.com/prestancedesign/inertia-clojure This version supports History.pushState (query-string appended to URI), so the app state is loaded/restored even after direct access to a URL Props are now optional via multi-arity render function. Some demo examples updated

👏 2
2021-05-19T15:13:12.006600Z

Oh yes of course, it's possible...this is even the core of Inertia. All the logic (routing, sign in -> auth -> redirect, etc) remains managed by the back end. Then handlers returning Inertia reponses take a front-end template (for each routes) in second arg: (inertia/render :the-template-name props)

2021-05-19T15:18:27.007100Z

In fact, it is more of a component than a template. This is then used in the front end (whether with CLJS Reagent, etc or JS React, Vue) with the same component name with with the props passed in 3rd argument. See: https://github.com/prestancedesign/reagent-inertia-reitit-integrant-fullstack/blob/main/front/src/reagent/inertia.cljs#L31

2021-05-19T15:22:35.007400Z

Hope this is more clear. I am planning more documentation, and tutorial and I am currently making the official Inertia demo "PingCRM" http://demo.inertiajs.com who cover authentication, etc in Clojure / ClojureScript which I will put online soon. Do not hesitate if you have other questions and stay tuned. 😉

tvaughan 2021-05-19T15:54:39.007600Z

> (inertia/render :the-template-name props) Ah ok. I didn't know the keyword meant template name. The example has just one template, (inertia/wrap-inertia routes template asset-version), and both routes have a different keyword but pass a map with a :title key which is in the one template passed to inertia/wrap-inertia

2021-05-19T16:02:46.007800Z

> I didn't know the keyword meant template name. Yes, I must to add docstring too for more clarity.

2021-05-19T16:09:22.008100Z

Indeed, the template passed to the wrap-inertia middleware is the "root template". It is the container with the js, css, meta, etc. scripts as well as the <div id="app" data-page="JSON object props" on which the front end components will be hooked. Check: https://inertiajs.com/server-side-setup#root-template

tvaughan 2021-05-20T21:56:24.010900Z

Thanks for taking the time to explain this to me and for providing these links

tvaughan 2021-05-18T20:35:38.003200Z

Is it possible to use different templates for different routes?

2021-05-18T21:03:58.004200Z

No, this has not been necessary at the moment. Can you specify for which case you would like to have this possibility? Thx

tvaughan 2021-05-18T21:15:01.004400Z

Signed in versus signed out? If the user isn't signed in, redirect her to sign in. Once signed in, redirect her to the dashboard. Different templates for public and protected content?