Skip to content
Snippets Groups Projects
Unverified Commit 190ea9fe authored by Walter Leibbrandt's avatar Walter Leibbrandt Committed by GitHub
Browse files

Don't lookup field ID for template tags, without a query (#10653)

* Don't lookup field ID for template tags, without a query

Based on snarfed/metabase@846f884

* Check for any falsey value instead of only `undefined`

* Mark `datasetQuery` parameter as optional

* Check for presence of `datasetQuery` only where it's being used
parent b55337e6
No related branches found
No related tags found
No related merge requests found
......@@ -63,12 +63,12 @@ export const getParametersBySlug = (
/** Returns the field ID that this parameter target points to, or null if it's not a dimension target. */
export function getParameterTargetFieldId(
target: ?ParameterTarget,
datasetQuery: DatasetQuery,
datasetQuery: ?DatasetQuery,
): ?FieldId {
if (target && target[0] === "dimension") {
const dimension = target[1];
if (Array.isArray(dimension) && dimension[0] === "template-tag") {
if (datasetQuery.type === "native") {
if (datasetQuery && datasetQuery.type === "native") {
const templateTag =
datasetQuery.native["template-tags"][String(dimension[1])];
if (templateTag && templateTag.type === "dimension") {
......
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