fulcro 2024-11-20

@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

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

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

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

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

there are tests, even, I beleive

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

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

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

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

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.

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

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

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.

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.

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

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

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