🐛 Corrige un bug critique sur les anciennes versions de Safari
Tentative de correction basée sur le rapport Sentry, mais non testée. Voir #1790.pull/1793/head
parent
cd9192e660
commit
31cdb29fc2
|
@ -12,9 +12,11 @@ const useIsPrintContext = () => {
|
|||
const matchMediaPrint = window.matchMedia('print')
|
||||
|
||||
setPrintContext(matchMediaPrint.matches)
|
||||
matchMediaPrint.addEventListener('change', matchListener)
|
||||
// `addEventListener` isn't supported by old versions of Safari and throws a
|
||||
// fatal error. See #1790 and https://stackoverflow.com/a/56466334
|
||||
matchMediaPrint?.addEventListener('change', matchListener)
|
||||
return () => {
|
||||
matchMediaPrint.removeEventListener('change', matchListener)
|
||||
matchMediaPrint?.removeEventListener('change', matchListener)
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
|
Loading…
Reference in New Issue