hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
George Ciobanu 2020-06-20T16:02:27.256500Z

@flyboarder thank you again, it worked, and I also broke it down into smaller chunks. I actually created a per-component cell so I can update them individually if needed (each component has multiple properties that are frequently edited by users)

flyboarder 2020-06-20T16:03:03.257Z

Yep probably a good way to do it!

George Ciobanu 2020-06-20T17:25:44.260800Z

I'm going crazy with this code. It creates 2 divs as expected but if I click button 1 first it deletes button 2 instead and then won't delete button 1 at all. However if I click button 2 first then button 1 it deletes correctly. Am I missing something obvious? Any help would be appreciated! I'm so close to getting it to work 😇

George Ciobanu 2020-06-20T17:30:13.261700Z

I think I did everything according to the wiki and sample source code

George Ciobanu 2020-06-20T17:37:24.264500Z

The text that prints the content of components is however updated correctly. @flyboarder am I possibly hitting an unusual corner case in Javelin?

dave 2020-06-20T18:34:52.265600Z

Cells inside cells feels a little weird to me. I don't think I ever do that.

dave 2020-06-20T18:35:31.266600Z

By that, I mean that you have a defc cell definition where the value is a map containing more cells

dave 2020-06-20T18:36:12.267900Z

I do fairly often have just a plain map (not wrapped in a cell) that includes cells as its values. Maybe that would work better?

George Ciobanu 2020-06-20T19:24:25.268300Z

I'll try it thank you so much @dave

🍻 1
George Ciobanu 2020-06-20T20:49:22.269600Z

I removed the inner cells and I get the same behavior. It seems that the collection is updated correctly but the wrong div is removed

flyboarder 2020-06-20T21:07:20.270300Z

@geo.ciobanu yeah, you cannot use cells within cells like that

flyboarder 2020-06-20T21:07:58.271100Z

there is special magic that cells do to find cells it depends on and wire them up

George Ciobanu 2020-06-20T21:08:24.272200Z

Makes sense. I removed them and only have the cell on the collection

flyboarder 2020-06-20T21:08:32.272400Z

therefor you cannot refer to a cell within a cell by anything other than a reference, ie. no anonymous usage within a cell

George Ciobanu 2020-06-20T21:09:57.272500Z

George Ciobanu 2020-06-20T21:10:36.273800Z

Even without cells inside cell the behavior is the same, I'm wondering if I need a closure over the div?

George Ciobanu 2020-06-20T21:10:53.274300Z

It seems like I'm doing basic Javelin stuff ...

George Ciobanu 2020-06-20T21:29:51.278400Z

Is it possible that what I'm trying to do is not a good fit for Javelin? @flyboarder I'm able to create the items, display them and bind a function to remove them from the collection. However when I click the correct item is removed from the collection but the div is incorrectly updated (unless I remove the last one first).

flyboarder 2020-06-20T21:32:32.279500Z

@geo.ciobanu you are dereferencing the cells that the for-tpl is giving you, this means the value internally is no longer updated based on the position in the list

flyboarder 2020-06-20T21:33:14.280500Z

you’ll want to pass those as attributes to the element you are trying to render so that when they update the element attributes are updated

flyboarder 2020-06-20T21:33:23.280700Z

you are close, but doing too much 😉

George Ciobanu 2020-06-20T21:33:44.281200Z

Lol ok that's refreshing, thank you

George Ciobanu 2020-06-20T21:36:44.283500Z

Omg I'm so dumb

George Ciobanu 2020-06-20T21:36:51.283900Z

It works!!!😍

George Ciobanu 2020-06-20T21:37:36.285100Z

I owe you a beer, whiskey or fancy tea, whichever you prefer :-)

flyboarder 2020-06-20T21:38:38.286100Z

donate to a local charity 😉

George Ciobanu 2020-06-26T20:13:28.288200Z

just a quick note, in case you want to see, that I'm using Hoplon (for now mostly Javelin) for a GUI editor and that it's working really nicely. http://lindenhoney.duckdns.org:7000 (you can select and move/resize items, and create new ones by clicking on the button on the top left bar and then clicking again on the canvas) I just thought you'd like to see it used in a slightly more unique tool

flyboarder 2020-06-26T20:14:44.288500Z

impressive

flyboarder 2020-06-26T20:15:01.288700Z

i want to build something similar to this, where we can generate hoplon apps from a gui

George Ciobanu 2020-06-26T20:16:57.288900Z

building a gui editor is not hard just different and no tutorials exist. happy to share my code to see how I did it - I'm using it to build a no code tool.

flyboarder 2020-06-26T20:17:22.289100Z

are you saving the contents to some cms?

flyboarder 2020-06-26T20:17:27.289300Z

or static html?

George Ciobanu 2020-06-26T20:17:33.289600Z

not yet - but I will save it in Datomic

George Ciobanu 2020-06-26T20:18:07.289900Z

because it has version history for free and a very powerful way to model hierarchical data

George Ciobanu 2020-06-26T20:25:23.290100Z

anyway for the actual app, there are two ways to do it: generate code from the EDN app structure (a form of compiling) or build and app that interprets the app structure and build the app dynamically (interpreter). I'm planning on going the interpreter path, which is a bit harder to build at first but allows for super easy and quick updates to the app

George Ciobanu 2020-06-26T20:26:38.290300Z

but the editor and the app are completely separate: the editor manipulates the app data structure and the app interprets and "executes" it. So once the editor is ready you can reuse it (or just use it) and create another app that creates a hoplon app dynamically

flyboarder 2020-06-26T20:27:42.290500Z

yep I had the same thought, to be able to use custom hoplon elements you would need to go the interpreter route

George Ciobanu 2020-06-20T21:38:49.286300Z

will do!

George Ciobanu 2020-06-20T21:40:17.287900Z

I won't spam more thank yous but I'm so so happy, I like Hoplon much more than Reagent, I really didn't want to use it. A thousand times thank you!