Open arishoham opened 1 year ago
Setting ssr
to true also doesn't seem to be working as expected as the preloaded component still required to wrap the tests inside act/waitFor
.
Although not a really clean solution, this can work as a temporary patch (inside the createFactory function):
let c = () => null;
const promiseLoader = loader().then((comp) => {
c = typeof comp === 'function' ? comp : comp.default || (() => null);
});
mockInitializers.push(() => promiseLoader);
return (props) => c(props);
With nextjs v13.1.7-canary.3, the 'preload' function no longer exists on
next/dynamic
components with{ssr: false}
, causing an errorCannot read property 'preload' of undefined