_toConsumableArray2 ReferenceError in simple codesandbox example
marco-m-alves opened this issue · 3 comments
marco-m-alves commented
Hi there, I'm problem making a very basic mistake in trying to get useWorker to work. Any hints/pointers would be very helpful. Thank you.
Context:
I'm trying to use useWorker
to parse large CSV files. Unfortunately, I've so far been unable to put a small example to work.
Problem:
The code sandbox example below gives the following error: ReferenceError: Can't find variable: _toConsumableArray2
Code:
https://codesandbox.io/s/hungry-einstein-4gsel?file=/src/App.js
import React, { useState } from "react";
import { useWorker } from "@koale/useworker";
import "./styles.css";
const processArray = () => {
const items = [...Array(1000).map((item, offset) => offset)];
return items.sort();
};
export default function App() {
const [data, setData] = useState("ready to start");
const [processWorker] = useWorker(processArray);
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
<button
onClick={_ => {
setData("started");
processWorker().then(_ => setData("finished"));
}}
>
Start
</button>
<p>{data}</p>
</div>
);
}
alewin commented
Hi @marco-m-alves, I don't understand why, but it seems to be a sandbox problem.
I ran the project locally and it works!
Here a demo
marco-m-alves commented
alewin commented
Thanks @marco-m-alves for reporting the Safari bug, now it should be fixed in 3.2.1
🚀