fix: page load crashes on iOS (and older phones)

my bad
This commit is contained in:
Maya 2026-03-11 11:36:58 +03:00
parent 8360970e25
commit 8e7b8ef35b
No known key found for this signature in database
1 changed files with 8 additions and 0 deletions

View File

@ -600,6 +600,14 @@ function findFirstPositive(
export const getMaxArrayBufferSize = (): number => {
if (typeof window === "undefined") return 2 * GB; // default for SSR
// lmao uh mobile devices definitely have a much lower limit and using binary search here
// was causing crashes especially on iOS, so just return 2GB to be safe :p
if (isMobile) {
log(["converters"], `mobile device detected, using 2GB fallback for max ArrayBuffer size`);
localStorage.setItem("maxArrayBufferSize", (2 * GB).toString());
return 2 * GB;
}
// check cache first
const cached = localStorage.getItem("maxArrayBufferSize");
if (cached) {