Fork me on GitHub
#fulcro
<
2020-11-21
>
Buidler13:11:23

I'm trying to do a remote mutation (deleting a note) and I'm having an issue when I get down to https://github.com/fulcrologic/fulcro/blob/fulcro-3.4.3/src/main/com/fulcrologic/fulcro/mutations.cljc#L80 Here's my trace... the issue is that it inserts this 2 nil into the state for some reason whereas I'm trying to delete :note/id 2. Update: I guess it's because of this part from the update-in docstring: > If any levels do not exist, hash-maps will be created. So in my case, [:note/id 2] does not exist, and it gets created as 2 nil, but why? I am deleting this exact object in the client mutation using:

(normalized-state/remove-entity state-map                      
                                [:note/id note-id]                      
                                #{:note/card-list :card-list/cards}) 
=> {:com.fulcrologic.fulcro.application/active-remotes #{}, :fulcro.inspect.core/app-id "buidler.ui/Root", :fulcro.inspect.core/app-uuid #uuid "fde8c483-7e26-4bfd-87fe-fdce9e8d9654", :note-form {:singleton #:note{:text ""}}, :note-list {:singleton #:note-list{:notes [[:note/id 1]]}}, :note/id {1 #:note{:delete-visible? false, :id 1, :text "foo from server"}}, :root/note-form [:note-form :singleton], :root/note-list [:note-list :singleton]}

lgessler17:11:16

it's hard for me to speculate just from what you've said--if you could share some code (e.g. for the mutations) that'd be helpful

Buidler17:11:39

@U49U72C4V it's a followup to this thread here https://clojurians.slack.com/archives/C68M60S4F/p1605367455177800 Note that the issue does not seem to be in rewrite-tempids!, but in update-errors-on-ui-component!.

lgessler17:11:09

ah i see thanks, boy that's a hairy thread

lgessler17:11:41

need go afk for the moment but if i were to debug this i think i'd try to find a way to look at what happens once the mutation response is received in the client, as early as possible

lgessler17:11:59

oh, and another idea in case you haven't tried it yet: the DB tab of fulcro inspect has a bar in the top left you can use to step through app state after every tx... might catch something interesting there

Buidler17:11:30

Thanks, will try those options.

Buidler21:11:30

Nothing really sticks out in the tx list:

16:14:48:940
(buidler.mutations/delete-note {:note/id 2})
16:14:46:566
6
(com.fulcrologic.fulcro.mutations/set-props {:note/delete-visible? true})
16:14:04:173
LOAD  
[{[:note-list :singleton]
  [{:note-list/notes
    [:note/id
     :note/text
     :note/delete-visible?
     {:note/card-list

tony.kay16:11:41

Does the nil cause any runtime problem? I’m not terribly interested in a “bug not bug” that leaves harmless nils laying around.

Buidler23:11:49

I thought it was causing a runtime problem on refresh, but the error is of course mine. I was neglecting to update the note-list-table which had the note ids, while at the same time deleting particular notes, so the ids in the table could no longer be found on the next refresh. Oh well, I learned lots about debugging through my stupid mistake :)

👍 3
lgessler21:11:42

typed dom/marquee, no match. sad 😢

lgessler21:11:12

i know i know, it's obsolete, user-hostile, etc.