Fix maps not loading in safari

This commit is contained in:
Mitchell McCaffrey 2021-06-25 19:50:29 +10:00
parent cb48e6f946
commit 8b1d208a72
2 changed files with 8 additions and 0 deletions

View File

@ -75,6 +75,9 @@ export function groupBy(array, key) {
}
export const isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
export const isSafari = /^((?!chrome|android).)*safari/i.test(
navigator.userAgent
);
export function shuffle(array) {
let temp = [...array];

View File

@ -8,6 +8,7 @@ import { encode, decode } from "@msgpack/msgpack";
import { getDatabase } from "../database";
import blobToBuffer from "../helpers/blobToBuffer";
import { isSafari } from "../helpers/shared";
// Worker to load large amounts of database data on a separate thread
let service = {
@ -45,6 +46,10 @@ let service = {
* @param {string} table
*/
async putData(data, table) {
if (isSafari) {
// Safari is unable to put data into indexedb and have useLiveQuery update
return false;
}
try {
let db = getDatabase({});
const decoded = decode(data);