From 1f8d79348dc5d1b6400582ba9e5c6e7c602cddae Mon Sep 17 00:00:00 2001 From: hmerritt Date: Sun, 11 Feb 2024 00:15:14 +0000 Subject: [PATCH] fix: return if key canvas functions do not exist --- src/view/components/experimental/DotGrid.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view/components/experimental/DotGrid.tsx b/src/view/components/experimental/DotGrid.tsx index 080f2ec..11a46b4 100644 --- a/src/view/components/experimental/DotGrid.tsx +++ b/src/view/components/experimental/DotGrid.tsx @@ -55,7 +55,9 @@ export const DotGrid: React.FC = ({ resetAnimationFrame(); const canvas = $canvas.current; - const ctx = canvas.getContext("2d"); + if (!canvas?.getContext) return; // Tests fail without this + + const ctx = canvas?.getContext("2d"); // Set canvas size if (refForMousePosition === "window") {