useNavigate - navigate(path) throws "computations created outside a `createRoot`" and error
Sometimes (not 100% of the time) when a user selects a new category in the UI, the following code sends
computations created outside aand thencreateRoot
orrender
will never be disposed
Uncaught (in promise) TypeError: Cannot read properties of null (reading '2')I have check thoroughly, all the
createMemo
and creatEffect
are properly in Components and not in any async handlers or the like.
If I replace the navigate
with window.location.replace
everything works fine, but of course, then my site reloads fresh every time too:
3 Replies
the weird thing is, sometimes it all works as expected , or only the warning is thrown. Then later the error occurs 100% of the time
the warning is also not very helpful as I'm not doing any createMemo in
Home.tsx
rather, the createMemo seems to happen inside <MetaProvider>
which is the component at the root of Home.tsx
.
import { MetaProvider, Title } from '@solidjs/meta';
Possibly a bug in solidjs/meta
when used with useNavigate ?it's definitely caused by the
MetaProvider
, if I remove it from the Home
the error goes away
diving further down, the problem in the <MetaProvider>
seems to be due to
PS; the selectedCategory
is
so It looks like I cannot use any reactive variables in <Title> </Title>
similar issues seem to happen when I do