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]}
Does the nil cause any runtime problem? I’m not terribly interested in a “bug not bug” that leaves harmless nils laying around.
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 :)
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
@lgessler 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!
.
ah i see thanks, boy that's a hairy thread
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
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
Thanks, will try those options.
typed dom/marquee
, no match. sad 😢
i know i know, it's obsolete, user-hostile, etc.
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