fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
tony.kay 2020-09-15T00:03:22.497100Z

I do not understand your intention. ao-identity? is a HINT to the RAD plugins that the given attribute can be used to find rows/entities, etc. It lets db plugs do things like generate indexes on that column, etc. The ao/identities is says what ID you can use to FIND the the attribute on which it is declared. So, you’re saying :content/id is an attribute that can be found IF you know either a :category/id or an :element/id. This is how the RAD plugins do things like figure out “entity” or “table” groupings (if supported in the given db), but it is also used to generate resolvers (if you have :category/id, then I can given you a :content/id).

tony.kay 2020-09-15T00:04:24.498100Z

in terms of “creation”. RAD Forms only know about the primary ID of an entity. The fact that there is an extra ID is up to you to deal with. I’d recommend looking at save middleware. You could examine incoming save deltas and augment them.

tony.kay 2020-09-15T00:04:55.498700Z

So, your RAD form probably would not even mention the alt ID? Not sure what all you’re trying to do, but those are my initial thoughts

xceno 2020-09-15T09:36:10.004500Z

I did mention it, but yes I'm sorry, my example wasn't very good. I've read all the docs and docstrings and watched your videos, so I think I roughly understand what's going on. I was just thinking way to complicated yesterday. Basically my intention is to connect all kinds of entities via an edge entity that has lots of metadata like so:

{:edge/id ...
  :edge/origin :ref ;; to whatever entity
  :edge/targets :ref ;; to multiply entities of any "type"
  :edge... ;; lots of other stuff
}
But now I'd need multiple keywords (all my various entity ids) for the ao/target on my origin and targets attributes, which obviously doesn't work. That's where my idea for a global :content/id attribute came from, that I slap on every entity. Anyway, I'll give the save-middlerware a shot. Thank you

xceno 2020-09-15T11:13:30.004700Z

> So, you’re saying `:content/id` is an attribute that can be found IF you know either a `:category/id` or an `:element/id`. Oh I think that's my problem, I wanted it the other way around. Thanks again. I shouldn't code after midnight

tony.kay 2020-09-15T15:16:58.007100Z

No, don’t do any of that content/id mess. What you want is to add all of your ID keys to identities on :edge/origin, etc. That is then in the intended design

tony.kay 2020-09-15T15:18:11.007300Z

oh, no, I see: to-many edges need many edge facts

tony.kay 2020-09-15T15:19:07.007500Z

If you’re using UUIDs, then a natural key for an edge is source-id, target-id

xceno 2020-09-15T15:19:55.007700Z

Well, you're right it turned out to be a mess indeed! I think simplifying my edges to only have one target would help here

tony.kay 2020-09-15T15:20:39.007900Z

not sure if leveraging that is easy for your application logic, but then you don’t need edges to have an id of their own…depends on if you want to reify the edge in a query of the graph (flatten it into the child, for example) or if you’re just trying to store it for separate analysis

xceno 2020-09-15T15:42:10.008100Z

Well, what I'm trying to do is modeling edges that act as constraints. So I can build a queries that walk a graph, but stop on certain edges that are forbidden. Or I walk a graph further down when I come across and edge that marks another entity as required. I designed this schema for datomic before starting this project, and I'm new to graph dbs and datomic, so I'm sorry if some of my statements seem confusing. I'm trying to figure things out as I go. But I'll give both your advices a try, I'm going to throw away my content/id thing and simplify my target attribute to a to-one ref. But thinking about your second point - flattening the edges into my entities might be a bit more work initially but should simplify it even more. I think I can figure it out from here. Thanks for your time, I really appreciate it! I'll build an exmple project for everyone to check it out once I solve this

tony.kay 2020-09-15T01:53:01.498800Z

.17 is working for me in quite large apps with dyn routing. Stale files, perhaps?

Mr. Savy 2020-09-15T03:06:42.000400Z

does it matter if I use a function for the :query as compared to just a vector? the book suggests saving them for unions from what I've seen.

tony.kay 2020-09-15T05:47:18.004400Z

Using lambda notation disables the macro's error checking, and disables other things like magic initial state. I never use fn except when error checking is mistaken

👍 1
tony.kay 2020-09-15T20:50:46.010200Z

Fulcro 3.3.0 now has better support for hot code reload when you’re using dynamic queries. This eliminates most needs to hard reload (browser refresh) the app. See http://book.fulcrologic.com/#_hot_code_reload_and_dynamic_queries

👏 5
tony.kay 2020-09-15T20:51:42.011100Z

TL;DR: Upgrade to 3.3.0, and add this to your refresh function that shadow-cljs calls:

(comp/refresh-dynamic-queries! app)

tony.kay 2020-09-15T20:52:04.011500Z

and enjoy fewer presses of CMD-R in chrome 🙂

tony.kay 2020-09-15T22:15:52.012500Z

I’m going to push 3.3.1…I accidentally left a debug logging message in 3.0.0 😕

cjmurphy 2020-09-15T22:37:38.014800Z

Fulcro RAD now has another possibility for storage: Key Value stores (in general). The repository is setup as another RAD Demo, just to demonstrate it all working. Please take a look: https://github.com/fulcrologic/fulcro-rad-kvstore

👍 9
az 2020-09-15T22:53:38.015200Z

Any thoughts on why after every other key stroke, if I submit this, stashed-text is null in submit-form. Also on this note, for local component state, should I be using an atom or the react local state mechanism? Thanks.

tony.kay 2020-09-15T22:57:38.016200Z

you’re not using update-state! correctly. If takes a function that gives you the old state, and you return new state…

tony.kay 2020-09-15T22:57:53.016600Z

so you’re walking into your data structure and using the nested data as the new data, which will only work once

az 2020-09-15T22:58:25.016700Z

Thank you I see!