-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hey! Humongous fan of perry!
Been playing around with perry-react today and hit a crash that I think is also responsible for the weather-app demo crashing on launch.
Calling a state setter inside useEffect panics every time:
function App() {
const [status, setStatus] = useState("idle")
useEffect(() => {
setStatus("started")
}, [])
return <div><h1>Status: {status}</h1></div>
}
thread '<unnamed>' panicked at crates/perry-ui-macos/src/state.rs:382:13:
RefCell already borrowed
My guess is the useEffect fires and triggers a re-render while the initial render is still holding a borrow on the state RefCell.
I initially found this when cloning & testing the weather-app and it crashes on launch with the same abort — pretty sure it's the same root cause since it calls setState from inside a fetch callback on startup. I couldn't get weather-app working so started a new react repo and ultimately hit this error
macOS ARM64, built from source, perry-react from PerryTS/react.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels