Skip to content
Snippets Groups Projects
Unverified Commit dba09929 authored by metabase-bot[bot]'s avatar metabase-bot[bot] Committed by GitHub
Browse files

Handle null value for field in CategoryFingerprint (#40861) (#40864)

parent 74160c66
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,7 @@ export function CategoryFingerprint({ ...@@ -61,7 +61,7 @@ export function CategoryFingerprint({
const isMissingFieldValues = fieldValues.length === 0; const isMissingFieldValues = fieldValues.length === 0;
const shouldFetchFieldValues = hasListValues && isMissingFieldValues; const shouldFetchFieldValues = hasListValues && isMissingFieldValues;
const distinctCount = field.fingerprint?.global?.["distinct-count"]; const distinctCount = field?.fingerprint?.global?.["distinct-count"];
const formattedDistinctCount = formatNumber(distinctCount); const formattedDistinctCount = formatNumber(distinctCount);
const [isLoading, setIsLoading] = useState(shouldFetchFieldValues); const [isLoading, setIsLoading] = useState(shouldFetchFieldValues);
......
...@@ -53,4 +53,11 @@ describe("CategoryFingerprint", () => { ...@@ -53,4 +53,11 @@ describe("CategoryFingerprint", () => {
expect(await screen.findByText("4 distinct values")).toBeInTheDocument(); expect(await screen.findByText("4 distinct values")).toBeInTheDocument();
}); });
}); });
it("should not throw an error when the field cannot be found", () => {
setup({ field: { id: 99942 } });
expect(
screen.queryByText("Getting distinct values..."),
).not.toBeInTheDocument();
});
}); });
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