Skip to content
Snippets Groups Projects
Unverified Commit d0c8536b authored by Braden Shepherdson's avatar Braden Shepherdson Committed by GitHub
Browse files

Add `dev.fe-helpers` to expose the current query to CLJS REPLs (#34997)

Use `(dev.fe-helpers/current-query)` from a CLJS REPL to get the query currently open in the UI.
parent bbf3c536
Branches
Tags
No related merge requests found
(ns dev.fe-helpers)
(defn redux-state []
(let [root (js/document.querySelector "#root")
store (.. root -_reactRootContainer -_internalRoot -current -child -memoizedProps -store)]
(.getState store)))
(defn current-card []
(.. (redux-state) -qb -card))
(defn current-legacy-query-js []
(.-dataset_query (current-card)))
(defn current-query []
(.-__MLv2_query js/window))
......@@ -1221,6 +1221,12 @@ class Question {
);
}
// Helpers for working with the current query from CLJS REPLs.
if (process.env.NODE_ENV === "development") {
window.__MLv2_metadata = metadata;
window.__MLv2_query = this.__mlv2Query;
}
return this.__mlv2Query;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment