kiliman/remix-typedjson

0.4.0 removes remix as peer dependency

Closed this issue · 3 comments

This commit removes @remix-run/react as peer dependency: 30f96e9. This made the use of useTypedLoaderData to throw this error:

Error: useLoaderData must be used within a data router.  See https://reactrouter.com/routers/picking-a-router.
     at Object.invariant [as UNSAFE_invariant] (node_modules/@remix-run/router/history.ts:480:11)
     at useDataRouterState (node_modules/react-router/lib/hooks.tsx:780:3)
     at Object.useLoaderData (node_modules/react-router/lib/hooks.tsx:861:15)
     at useLoaderData (node_modules/@remix-run/react/dist/components.js:896:25)
     at useTypedLoaderData (node_modules/remix-typedjson/dist/remix.js:84:44)
     at MyRoute (build/index.js:13370:53)
     at renderWithHooks (node_modules/react-dom/cjs/react-dom-server.node.development.js:5724:16)
     at renderIndeterminateComponent (node_modules/react-dom/cjs/react-dom-server.node.development.js:5797:15)
     at renderElement (node_modules/react-dom/cjs/react-dom-server.node.development.js:6012:7)
     at renderNodeDestructiveImpl (node_modules/react-dom/cjs/react-dom-server.node.development.js:6170:11)
     at renderNodeDestructive (node_modules/react-dom/cjs/react-dom-server.node.development.js:6142:14)
     at renderContextProvider (node_modules/react-dom/cjs/react-dom-server.node.development.js:5986:3)
     at renderElement (node_modules/react-dom/cjs/react-dom-server.node.development.js:6083:11)
     at renderNodeDestructiveImpl (node_modules/react-dom/cjs/react-dom-server.node.development.js:6170:11)
     at renderNodeDestructive (node_modules/react-dom/cjs/react-dom-server.node.development.js:6142:14)
     at renderIndeterminateComponent (node_modules/react-dom/cjs/react-dom-server.node.development.js:5851:7)
Error: useLoaderData must be used within a data router.  See https://reactrouter.com/routers/picking-a-router.

Going back to 0.3.1 removed the error.

Fixed in v0.4.1

Hi @kiliman I'm afraid I'm still getting this with 0.4.1 (with Remix 2.4.1 or 2.5.0)

Any ideas?

Error: useLoaderData must be used within a data router.  See https://reactrouter.com/routers/picking-a-router.
    at Object.invariant [as UNSAFE_invariant] (node_modules/remix-typedjson/node_modules/@remix-run/react/node_modules/@remix-run/router/history.ts:494:11)
    at useDataRouterState (node_modules/remix-typedjson/node_modules/@remix-run/react/node_modules/react-router/lib/hooks.tsx:838:3)
    at Object.useLoaderData (node_modules/remix-typedjson/node_modules/@remix-run/react/node_modules/react-router/lib/hooks.tsx:909:15)
    at useLoaderData (node_modules/remix-typedjson/node_modules/@remix-run/react/dist/components.js:684:25)
    at Module.useTypedLoaderData (node_modules/remix-typedjson/dist/remix.js:82:44)
    at… (my route)

Do you have a sample repo? It's kind of hard to say what the issue is without some code.