Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

closes EMB-734 iframe+matchMedia crashing in Safari (#62407)

Sébastien03822446fb38
diff --git a/patches/@mantine+hooks+8.0.2.patch b/patches/@mantine+hooks+8.0.2.patch
new file mode 100644
index 00000000000..6e5a06b5181
--- /dev/null
+++ b/patches/@mantine+hooks+8.0.2.patch
@@ -0,0 +1,26 @@
+diff --git a/node_modules/@mantine/hooks/esm/use-media-query/use-media-query.mjs b/node_modules/@mantine/hooks/esm/use-media-query/use-media-query.mjs
+index c175ddb..6460b82 100644
+--- a/node_modules/@mantine/hooks/esm/use-media-query/use-media-query.mjs
++++ b/node_modules/@mantine/hooks/esm/use-media-query/use-media-query.mjs
+@@ -22,12 +22,17 @@ function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
+ const [matches, setMatches] = useState(
+ getInitialValueInEffect ? initialValue : getInitialValue(query)
+ );
+- const queryRef = useRef(null);
+ useEffect(() => {
+ if ("matchMedia" in window) {
+- queryRef.current = window.matchMedia(query);
+- setMatches(queryRef.current.matches);
+- return attachMediaListener(queryRef.current, (event) => setMatches(event.matches));
++ try {
++ const mediaQuery = window.matchMedia(query);
++ setMatches(mediaQuery.matches);
++ return attachMediaListener(mediaQuery, (event) => setMatches(event.matches));
++ } catch (e) {
++ // Safari iframe compatibility issue
++ console.warn('MediaQuery not available in iframe:', e);
++ return void 0;
++ }
+ }
+ return void 0;
+ }, [query]);