Fork me on GitHub
#fulcro
<
2022-11-29
>
Eva O03:11:29

fulcro-rad-semantic-ui has a bug in the container renderer. (container/id-child-pairs children) should be (container/id-child-pairs container-instance)

tony.kay19:11:28

Hi Eva. I think the containers are mainly used in the demo, and not heavily tested…they have a number of issues I’m sure. If you could make an issue and describe things better, I’ll see if I can get to it. (line/diff)

Eva O19:11:19

I made a Material UI plugin that I'm on the fence about making public so I've been looking through the Semantic UI plugin for inspiration

tony.kay00:12:54

The more the merrier 🙂

genekim04:03:28

> I made a Material UI plugin that I'm on the fence about making public so I've been looking through the Semantic UI plugin for inspiration > Hi, @eoogbe — I'd be super interested and would get a ton of value out of checking out your Material UI plugin. @tony.kay Is there a 30s answer to "what is the state of the React Native rendering plugin?" The reason for all these questions/requests: I have been having so much fun writing some simple apps in #membrane by @smith.adriane that I'm finding the temptation to write some tabular data display apps. ...and then tempted to leverage all the fantastic work you've done in Fulcro RAD reports. I must admit, I've been studying the Semantic UI plugin source for a couple of days, pondering the level of effort to just get a working RAD report in Membrane. I've successfully modified the SUI controls before, which was confidence inspiring. But lots of things scare/deter me from jumping into this, including the absence of the Fulcro Inspector, not knowing at all what absence of routes means, how an RAD app would support two rendering plugins (membrane and SUI), etc. But it's been fun to ponder. Thank you, all!

genekim05:03:25

(To clarify: all this is enabled by the fact the @smith.adriane has already built/ported Fulcro that can be used by Membrane — a working defsc already exists, so I'm presuming that it's possible to just built upon that...)

phronmophobic05:03:00

I readily admit that I don't totally comprehend all the different pieces involved, but I'm happy to share what I do know to see if we can make @U6VPZS1EK’s vision a reality. There's lots of cool stuff in fulcro. It would be great to see if there's a way to leverage it with membrane.

phronmophobic05:03:33

It's been a while, but one of the major hurdles was that most fulcro components rely on HTML. If there are components that use primitives that can be automatically translated to shapes, text, and images, then there might be a big opportunity here. I know some of react native's primitives are closer to membrane's view model.

tony.kay05:03:17

Fulcro components do not, in fact, rely on HTML. Not sure what you’re referring to there. Depending on the namespaces you use, you can end up with a hard React dependency.

👍 2
tony.kay05:03:43

It does expect there to be some kind of rendering alg to exist that allows it to “root render” every frame. React is the tool normally used for that. So, some kind of “vdom” concept has to exist for any target. In terms of the “state of react native”, it worked last time I used it (including electron-based Inspect), but native moves quickly, and I’ve not kept up with it, so it is likely out of date.

phronmophobic05:03:10

I didn't mean that fulcro itself relied on HTML, but that components returned html elements for the most part. Is that not the case?

tony.kay05:03:43

no. The rendering pipeline is fully pluggable, though it does, by default, want to render from root as a tree

tony.kay05:03:57

the render functions (body of defsc) can return whatever data you want.

tony.kay05:03:23

Fulcro React Native returns elements from the native toolkit in React

phronmophobic05:03:03

Right, but I couldn't find any existing components that returned anything other than HTML (maybe I wasn't looking hard enough).

tony.kay05:03:44

everything I’ve written has been for react/native, so yes, all the code from me will be returning react elements, but in native those are not html. They are just elements, which React defines.

tony.kay05:03:46

Now, if you were to write a react look-alike say for Swing or something, where you output a data structure that could be diff’d against backing mutable components, it would also work just fine.

phronmophobic05:03:54

Cool, as long as it returns something that can be turned into shapes, text, and images (and is much less work than writing a full HTML engine)

tony.kay05:03:45

Yeah, I wrote a reconciler for a hobby project a few years ago that reconciled to three.js, but I did that as a separate kind of reconciler from the state of the FUlcro app itself.

tony.kay05:03:13

So Fulcro was doing state management (and React UI for managing the non-3d stuff), but there was a side-reconciler that did the three.js updates from the normalized Fulcro database.

phronmophobic05:03:17

I'm not sure if @U6VPZS1EK’s plan involves using existing components and if those existing components require some soft of HTML engine.

genekim05:03:48

This is great — one plan of attack I had in mind was taking an working Fulcro RAD app, cloning it, and modifying the SUI report.cljc to return not DOM elements, but membrane ui, and see how far I can get. The hope is that by the end, I would have a defsc component that membrane would actually be able to render. (With plenty of stuff stubbed out that membrane can't immediately handle.) And I'd build the membrane equivalent of table, td, tr, etc.

phronmophobic05:03:05

I'm just catching up on some Fulcro RAD reading. > Fulcro works quite well on the web, in React Native, and in Electron. Notice that the core of RAD is built around auto-generation of UI, meaning that many features of RAD will work equally well in any of these settings. This sounds very interesting!

genekim05:03:18

No, absolutely no reliance on HTML — converting from DOM elements to membrane UI elements.

tony.kay05:03:49

Yeah, most of RAD is data loading, paginating, etc. Data management stuff. I think RAD is going to give you a code dependency on React, though, because it outputs defsc components that support React lifecycle methods. It’s not built on “raw” Fulcro components.

genekim05:03:30

The process: • remove dom ns, so it won't compile any more • one by one, replace all dom elements with membrane ui elements, until it compiles again • have membrane render it Voila. Working Fulcro RAD app on membrane. 😆

clj-easy 2
tony.kay05:03:21

Not sure it is going to be quite that easy. Membrane doesn’t support React does it?

phronmophobic05:03:55

There are ways to mimic lifecycle events (although no library or documentation support).

genekim05:03:24

No. Think about the terminal TODO app that @smith.adriane wrote. That would be the potential target -- no react there. 😆

tony.kay05:03:26

So, there’s no need for lifecycle. You can add use-hooks? true and you’ll get a pure function.

🤯 2
genekim05:03:12

Whoa. Thanks for that tip, Tony.

tony.kay05:03:13

but you’ll still have to have React in package,json because it’ll be required by the various nses…doesn’t mean yo uhave to use it.

phronmophobic05:03:55

And fair warning, the fulcro proof of concept with membrane was pretty minimal, so there might be more support needed on membrane's end. My recollection was that fulcro was pretty good at managing state and returning views. Hopefully membrane can do its part.

tony.kay05:03:04

from RAD at least. I actually wrote the raw.components and raw.application nses in response to interest from @smith.adriane. 😉 So, those do not use React at all. But if you want RAD you’re going to get a React dependency

phronmophobic05:03:44

Is the RAD stuff cljc? I think the goal was a JVM app. Would the clj stuff pull in react?

tony.kay05:03:53

everything I write is CLJC

tony.kay05:03:05

no, CLJ would not pull in React

tony.kay05:03:29

but that side is nowhere near as well-tested, since it’s there primarily for SSR, which few ppl do

genekim05:03:29

In my ideal, imagine having working RAD app. add one more dependency for membrane rendering plugin, and now you can get desktop window with RAD report running, No need for shadow-cljs, or browser. That would delight me!

tony.kay05:03:44

Yes, that is totally possible

tony.kay05:03:52

easier, in fact, probably, than doing it in CLJS

tony.kay05:03:39

in CLJ the use-hooks? trick isn’t even necessary. They aren’t real components there. The SSR stuff just returns nested data that code in FUlcro can turn into HTML (server.dom), but it’s just data.

tony.kay05:03:14

RAD also has explicit call support for starting the state machines that go with reports/forms, so that should work fine as well

genekim05:03:32

You'd have to install the membrane ui plugin in client.cljs. And then REPL, do something like "skia/run #'report-name." What do you think, Tony? am I totally off my rocker?

tony.kay05:03:50

no, but you’d be using CLJ, not CLJS

genekim05:03:10

Ah, right,, gotta do "report run" to get the machinery running first...

phronmophobic05:03:39

I'm sure there are some sharp edges on membrane's side, but sounds plausible.

tony.kay05:03:41

and dynamic routing in Fulcro is the default way to “start” things for RAD, but I don’t know that DR will work right in CLJ

genekim05:03:52

Absolutely. no CLJS in this scenario. All running in the same JVM as server.

tony.kay05:03:53

so, you’d call the explicit starts, yes

tony.kay05:03:27

If you want networking you’d have to write your own “remote” implementation for the client in CLJ, but that’s pretty easy

genekim05:03:15

(On DR: honestly, I still don't actually know what DR is... I rely on the RAD Demo code to do all that. :) so, some magic needed to get all that machinery started... Oh, I haven't thought through carefully enough how the CLJ client would build up its state -- I got as far as "RAD report will do the df/load! for me." But many things are fuzzy for me on what that actually means. Your reaction of that being "easy" is reassuring, tho!

tony.kay05:03:13

dynamic routing. You must be making defrouter’s or how are you composing your app?

tony.kay05:03:57

and df/load! requires networking code. http_remote is a component that is only CLJS. So, I lied, not everything I do is CLJC 😄

tony.kay05:03:34

Just read http_remote.cljs and ape the structure, but convert the networking calls to CLJ stuff

genekim05:03:58

Tony, quick question: is there an example of df/load running on the JVM? Ah, you just answered this. Perfect! That doesn’t seem to difficult! Have a great night all!

👍 2
genekim06:03:44

Thank you @tony.kay and @smith.adriane !!! Educational and energizing!!

clojure-spin 1
tony.kay06:03:12

Good luck Gene

Eric Dvorsak09:03:06

@U6VPZS1EK @eoogbe Definitely interested in the MaterialUI plugin as well, I was planning on working on that in the future, but would start using now and contribute if there was already one available

John Poulakos15:11:45

I'm running into an issue with RAD and nested subforms. When creating a subform that contains nested subforms, those nested subforms are given tempids and expanded on-create. These nested subforms are not required data, and, if left empty, prevent saving. I was hoping to find something similar to ::form/autocreate-on-load? false to control this, but haven't come up with anything yet.

John Poulakos15:11:28

exploring the form create! options now

tony.kay19:11:12

Don’t create the edge with anything in it. Make the user press a button to add the optional data. Otherwise you’ll have to customize the top-level validator on your form to make that a valid case AND update your save middleware to handle the case (and not try to create an empty entity)

John Poulakos21:11:04

That's exactly right, and an issue I ran into with a previous application. So, will I need to forgo nesting subforms to achieve this in RAD? I see the desired behavior happen when existing data is loaded into the subform. In that case, only the nested subforms/edges with data exist, and the rest present a 'Create' button. Perfect! But in the case of creating new data, clicking 'Create' on the top-level subform produces a form where all nested subforms/edges exist, and the user must delete those empty subform entries to successfully save. I've tried a few options, such as ::form-options/default-values , to no avail.

tony.kay06:11:57

Default values is supposed to work on that…but I’d have to review things to be able to say exactly how to do it. The intention is for you to have to option for create to either pre-create them or leave them out…are these to-one or to-many?

tony.kay06:11:02

I use RAD in production, but there are still a number of rough edges and use-cases that I have not personally stressed. Of course the documentation could also use a bit of a boost. Did you look at the RAD book around this? I thought I documented forms pretty well, but I’m sure I missed some things

John Poulakos17:12:12

I've created a PR: https://github.com/fulcrologic/fulcro-rad/pull/101 We can move the convo there. In short, I did a bit of digging yesterday and solved the problem by overriding the default form-machine's add-row event, essentially duplicating it but modifying the function default-state in form.cljc . The docstring for default-state says that to-one ref's without default value(s) will not be included, but they were!

genekim04:03:28

> I made a Material UI plugin that I'm on the fence about making public so I've been looking through the Semantic UI plugin for inspiration > Hi, @eoogbe — I'd be super interested and would get a ton of value out of checking out your Material UI plugin. @tony.kay Is there a 30s answer to "what is the state of the React Native rendering plugin?" The reason for all these questions/requests: I have been having so much fun writing some simple apps in #membrane by @smith.adriane that I'm finding the temptation to write some tabular data display apps. ...and then tempted to leverage all the fantastic work you've done in Fulcro RAD reports. I must admit, I've been studying the Semantic UI plugin source for a couple of days, pondering the level of effort to just get a working RAD report in Membrane. I've successfully modified the SUI controls before, which was confidence inspiring. But lots of things scare/deter me from jumping into this, including the absence of the Fulcro Inspector, not knowing at all what absence of routes means, how an RAD app would support two rendering plugins (membrane and SUI), etc. But it's been fun to ponder. Thank you, all!