Closed
Description
I believe I found a bug. When I pass in a value to a useWorker that relies on a param, the result appears to be cached. It's hard to explain... for the following code:
const {result} = useWorker(createExpensiveFetch, someParam)
console.log(someParam, result)
It produces console logs like this...
123, { a: 'Hello World', b: 123 },
Then on change of someParam
to be 124
, I see:
124, { a: 'Hello World', b: 123 },
124, { a: 'Foo Bar', b: 124 },
Basically, I have a hook that takes a prop that can change, and it takes tome to process the worker data (think a data fetch)... but when the param changes, the result/error values seem to be the ones corresponding to the previous param. I've gotten around it by making sure the value of result.b
matches someParam
, but this seems like a bug?
Metadata
Metadata
Assignees
Labels
No labels