Fork me on GitHub
#hoplon
<
2020-06-20
>
George Ciobanu16:06:27

@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)

flyboarder16:06:03

Yep probably a good way to do it!

George Ciobanu17:06:44

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 Ciobanu17:06:13

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

George Ciobanu17:06:24

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

dave18:06:52

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

dave18:06:31

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

dave18:06:12

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 Ciobanu19:06:25

I'll try it thank you so much @dave

🍻 3
George Ciobanu20:06:22

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

flyboarder21:06:20

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

flyboarder21:06:58

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

George Ciobanu21:06:24

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

flyboarder21:06:32

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

George Ciobanu21:06:36

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

George Ciobanu21:06:53

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

George Ciobanu21:06:51

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).

flyboarder21:06:32

@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

flyboarder21:06:14

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

flyboarder21:06:23

you are close, but doing too much 😉

George Ciobanu21:06:44

Lol ok that's refreshing, thank you

George Ciobanu21:06:44

Omg I'm so dumb

George Ciobanu21:06:51

It works!!!😍

George Ciobanu21:06:36

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

flyboarder21:06:38

donate to a local charity 😉

George Ciobanu20:06:28

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

flyboarder20:06:01

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

George Ciobanu20:06:57

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.

flyboarder20:06:22

are you saving the contents to some cms?

flyboarder20:06:27

or static html?

George Ciobanu20:06:33

not yet - but I will save it in Datomic

George Ciobanu20:06:07

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

George Ciobanu20:06:23

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 Ciobanu20:06:38

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

flyboarder20:06:42

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

George Ciobanu21:06:17

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!