IgnisDa / npm-libs

A set of packages for different javascript needs
https://www.npmjs.com/~ignisda
MIT License
8 stars 6 forks source link

useLocation issue with remix-pagination #2

Open nkrmr opened 1 year ago

nkrmr commented 1 year ago

Hi, i have this issue when i tried to add remix-pagination to my project

An unknown error occured.
The stack trace is:

Error: useLocation() may be used only in the context of a <Router> component.
    at invariant (/Volumes/Workspace/www/lesfoodcuisine/node_modules/@ignisda/packages/react-router/lib/router.ts:5:20)
    at Object.useLocation (/Volumes/Workspace/www/lesfoodcuisine/node_modules/@ignisda/packages/react-router/lib/hooks.tsx:75:3)
    at Object.useSearchParams (/Volumes/Workspace/www/lesfoodcuisine/node_modules/@ignisda/packages/react-router-dom/index.tsx:444:18)
    at RemixPagination (/Volumes/Workspace/www/lesfoodcuisine/node_modules/@ignisda/remix-pagination/index.cjs:1971:26)
    at renderWithHooks (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:5662:16)
    at renderIndeterminateComponent (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:5735:15)
    at renderElement (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:5950:7)
    at renderNodeDestructiveImpl (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:6108:11)
    at renderNodeDestructive (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:6080:14)
    at renderNode (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:6263:12)
    at renderChildrenArray (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:6215:7)
    at renderNodeDestructiveImpl (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:6145:7)
    at renderNodeDestructive (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:6080:14)
    at renderElement (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:5975:9)
    at renderNodeDestructiveImpl (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:6108:11)
    at renderNodeDestructive (/Volumes/Workspace/www/lesfoodcuisine/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:6080:14)
IgnisDa commented 1 year ago

Hello @nkrmr! Could you please share the repo where this occurred? Or a minimal reproduction would be fine too.

I updated the remix version for the example app and it works fine so I think the error must be specific to your setup.

nkrmr commented 1 year ago

Yes sorry i found the issue, everything works fine. THX

chirdeeptomar commented 1 year ago

It's not working with the latest version of remix, just upgraded remix and unable to start the app.

IgnisDa commented 1 year ago

@chirdeeptomar What is the error?

chirdeeptomar commented 1 year ago

@chirdeeptomar What is the error?

Same as above.

"dependencies": { "@strapi/plugin-i18n": "4.6.1", "@strapi/plugin-users-permissions": "4.6.1", "@strapi/strapi": "4.6.1", "better-sqlite3": "7.6.2", "pg": "^8.9.0", "strapi-plugin-import-export-entries": "^1.18.0", "strapi-plugin-meilisearch": "^0.9.1", "strapi-plugin-rest-cache": "^4.2.6", "strapi-plugin-slugify": "^2.3.2" },

chirdeeptomar commented 1 year ago

Uninstalled and installed again, works now!

blitze commented 11 months ago

I am running into the same error. Please check it out:

https://codesandbox.io/p/sandbox/peaceful-bash-ynfqxr

IgnisDa commented 11 months ago

Hey @blitze I have not maintained this library for a long time. If you want to fix it and make a PR, I can review and publish it to NPM, but I will not work on it myself.