Skip to content
Snippets Groups Projects
Unverified Commit 6e0f5059 authored by Tim Macdonald's avatar Tim Macdonald Committed by GitHub
Browse files

Move QueryField creation to the card's after-update (#41421)

parent e9256fda
No related branches found
No related tags found
No related merge requests found
...@@ -548,12 +548,14 @@ ...@@ -548,12 +548,14 @@
pre-update pre-update
populate-query-fields populate-query-fields
maybe-populate-initially-published-at maybe-populate-initially-published-at
;; TODO: this should go in after-update once camsaul/toucan2#129 is fixed
;; It's at the end for now so that all the before-update validations have a chance to run
;; TODO the Second: No reason this couldn't be async, especially once it's in the after-update
(doto query-analyzer/update-query-fields-for-card!)
(dissoc :id))) (dissoc :id)))
(t2/define-after-update :model/Card
[card]
(u/prog1 card
(when (contains? (t2/changes card) :dataset_query)
(query-analyzer/update-query-fields-for-card! card))))
;; Cards don't normally get deleted (they get archived instead) so this mostly affects tests ;; Cards don't normally get deleted (they get archived instead) so this mostly affects tests
(t2/define-before-delete :model/Card (t2/define-before-delete :model/Card
[{:keys [id] :as _card}] [{:keys [id] :as _card}]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment