mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-22 21:45:56 +03:00
fix(hooks): fix web worker security error
This commit is contained in:
parent
5aa62e9af0
commit
145ce319a4
@ -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;
|
||||
|
@ -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(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user