Skip to content

Commit

Permalink
Refactored uses of registry keys to accept all legal registry key types.
Browse files Browse the repository at this point in the history
  • Loading branch information
awkay committed Oct 3, 2023
1 parent 89bbd65 commit 91a05c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
20 changes: 9 additions & 11 deletions src/main/com/fulcrologic/fulcro/mutations.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
remote-error? (ah/app-algorithm app :remote-error?)
{:keys [dispatch-key]} transmitted-ast
return-value (when dispatch-key (get-in result [:body dispatch-key]))
env (assoc env :mutation-return-value return-value)]
env (assoc env :mutation-return-value return-value)]
(if (remote-error? result)
(when error-action
(error-action env))
Expand Down Expand Up @@ -342,17 +342,15 @@
(returning env class nil))
([env class {:keys [query-params]
:as opts}]
(let [class (if (or (keyword? class) (symbol? class))
(rc/registry-key->class class)
class)]
(let [class (rc/registry-key->class class)]
(let [{:keys [state ast]} env
{:keys [key params query]} ast]
(let [component-query (rc/get-query class @state)
updated-query (cond-> (eql/query->ast component-query)
query-params (update-in [:children 0] assoc :params query-params)
:then (eql/ast->query)
query (vary-meta #(merge (meta query) %)))]
(assoc env :ast (eql/query->ast1 [{(list key params) updated-query}])))))))
{:keys [key params query]} ast
component-query (rc/get-query class @state)
updated-query (cond-> (eql/query->ast component-query)
query-params (update-in [:children 0] assoc :params query-params)
:then (eql/ast->query)
query (vary-meta #(merge (meta query) %)))]
(assoc env :ast (eql/query->ast1 [{(list key params) updated-query}]))))))



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
last-time (or last-attempt 0)
n (min attempt 1000)
delay (min backoff-limit-ms (* n n 1000))
options (if (keyword? (:component options))
options (if (rc/legal-registry-lookup-key? (:component options))
(update options :component rc/registry-key->class)
options)]
(if (or (= 0 attempt) (> (- now last-time) delay))
Expand Down Expand Up @@ -234,7 +234,7 @@
[app mutation-store tempid-strategy]
(let [app (-> app
(update :com.fulcrologic.fulcro.application/config merge {::mutation-store mutation-store
::tempid-strategy tempid-strategy})
::tempid-strategy tempid-strategy})
(with-augmented-result-action)
(with-durable-transact))]
(transaction-loop! app)
Expand Down

0 comments on commit 91a05c0

Please sign in to comment.