fulcro

Eric Dvorsak 2024-11-20T15:10:21.624169Z

@tony.kay is it expected that in statecharts, fulcro/aliases are not following idents in the path. eg I have [:actor/current-course :course/language-course :language-course/target-language] where :course/language-course is an indent in the app db, so :language-course/target-language is always nil because it doesn't lookup at this indent

tony.kay 2024-11-20T15:49:16.612229Z

If you've assigned an ident to that actor, then I would expect that alias to work.

Eric Dvorsak 2024-11-20T16:00:51.960039Z

from what I can tell fulcro_impl/resolve-aliases doesn't follow idents it is just a get-in on the state-map

Eric Dvorsak 2024-11-20T16:16:44.417229Z

fn [acc alias]
        (let [expanded-path (resolve-alias-path local-data alias)]
          (assoc acc alias (get-in state-map expanded-path)))

tony.kay 2024-11-20T17:22:14.174139Z

resolve-alias-path tries to flatten your alias path to a real db path that can be used with get-in

tony.kay 2024-11-20T17:22:21.260699Z

there are tests, even, I beleive

Eric Dvorsak 2024-11-20T18:38:55.931599Z

I don't see anything there that would resolve an ident

Eric Dvorsak 2024-11-20T18:39:58.638459Z

In the example I gave I am not talking about the actor itself, but a property being normalized, and therefore an ident instead of a map

Eric Dvorsak 2024-11-20T19:22:20.405409Z

I was thinking of aliasing language-course as [:actor/current-course :course/language-course] as a workaround but the docs say Aliases are NOT used within paths

tony.kay 2024-11-20T19:57:25.804619Z

correct…the point of an actor is to have a variable ident. The point of an alias is to point to a property on an actor. So, the combo of [:actor/x :prop] -> [:thing/id 11 :prop], which is a get-in path in the db

tony.kay 2024-11-20T19:58:21.240749Z

but now that I understand what you are looking for, correct, I do not do full graph interpolation of a path like that, though you could easily write such a thing yourself.

Eric Dvorsak 2024-11-20T20:00:26.203959Z

as a PR to statecharts or you mean it can be done at application lvl?

tony.kay 2024-11-21T11:05:26.194069Z

I was thinking application level. Operations on the data model are implemented with a multimethod

Eric Dvorsak 2024-11-21T11:10:03.604209Z

I noticed this is also an issue with statemachine. For me there's the issue that it is a mismatch with Fulcro data model since components are normalized in the db. there is a resolve-actors function that already mostly solves the issue on reads, but it would need to be implemented on writes. For now I gave up on using these sort of aliases and added some extra code in the statechart to get the value from resolve-actor since I only read in my case.

Yaw Odame 2024-11-20T16:43:52.663909Z

Has anyone had any luck resolving fulcro functions defined with guardrail macros to resolve in intellij? In this example, usim/set-aliased-value is defined with >defn macro.

Joe R. Smith 2024-11-25T01:47:09.094999Z

This is correct ^ tell intellij to create it as a defn

Yaw Odame 2024-11-20T16:44:41.876439Z

BTW, I ran the kondo script to download the config.edn files.

gnl 2024-11-21T14:37:35.882229Z

You probably just need to go to any instance of >defn or create a new one, click the quickfix lightbulb to open the menu and select "Resolve as..." -> "defn"

👍 1
👀 1