getCacheForType is not a function
shellscape opened this issue · comments
Andrew Powell commented
Hey there. Interesting project, thanks for putting it together. I installed v0.0.50 and used the code below, and received the error below.
import { createCache } from 'suspense';
const cache = createCache({
load: () => new Promise<string>((resolve) => setTimeout(() => resolve('done'), 2000))
});
TypeError: getCacheForType is not a function
at getOrCreateRecord (/node_modules/.pnpm/suspense@0.0.50_react-dom@18.2.0_react@18.2.0/node_modules/suspense/dist/suspense.cjs.js:317:38)
at Object.read (/node_modules/.pnpm/suspense@0.0.50_react-dom@18.2.0_react@18.2.0/node_modules/suspense/dist/suspense.cjs.js:405:20)
Mark Erikson commented
@shellscape are you using an experimental build of React, rather than the stable 18.2 or similar build?
Andrew Powell commented
Ah, I'm using stable 18.2.0
I'm learning about react suspense internals now and didn't realize that what the readme refers to are npm tags.
Mark Erikson commented
Yeah, React uses feature flags to enable experimental features in non-stable builds, and getCacheForType
only exists in experimental builds.
Brian Vaughn commented