fix(hooks): fix web worker security error

This commit is contained in:
Aminejv 2021-09-24 18:44:04 +01:00
parent 5aa62e9af0
commit 145ce319a4
2 changed files with 2 additions and 3 deletions

View File

@ -425,7 +425,7 @@ export const useLockScroll = ({ lock = true } = {}) => {
}, [lock]);
};
export const useWorker = ({ onStart, onMessage, onError, path } = {}, dependencies = []) => {
export const useWorker = ({ onStart, onMessage, onError } = {}, dependencies = []) => {
const workerRef = React.useRef();
const onStartRef = React.useRef();
@ -438,7 +438,7 @@ export const useWorker = ({ onStart, onMessage, onError, path } = {}, dependenci
onErrorRef.current = onError;
React.useEffect(() => {
const worker = new Worker(new URL(path, import.meta.url));
const worker = new Worker(new URL("../workers/filter-files.js", import.meta.url));
if (!worker) return;
workerRef.current = worker;

View File

@ -72,7 +72,6 @@ const useFilterWorker = ({ filterState, setFilterObjects, library }) => {
useWorker(
{
path: "../workers/filter-files.js",
onStart: (worker) => {
worker.postMessage({ objects: library, view, subview, type });
timeoutRef.current = setTimeout(() => {