moshest / next-client-cookies

SSR and client support for cookies in Next.js 13 (app directory)
MIT License
144 stars 9 forks source link

update import <CookiesProvider> #18

Closed lidforce closed 7 months ago

lidforce commented 7 months ago

update the CookiesProvider import, the default import in VSCode is as follows:

import { CookiesProvider } from "next-client-cookies";

and the import is considered deprecated. The readme says that you should specify import { CookiesProvider } from "next-client-cookies/server";

it took me a long time to figure out why the console was constantly displaying

⨯ node_modules\next-client-cookies\dist\hook.js (44:0) @ eval
 ⨯ Error: Missing <CookiesProvider>
    at CreateUserPage (./src/app/admin/create-user/page.tsx:67:84)
null

Because of my inattention in the readme, I didn't understand what caused the error.

moshest commented 7 months ago

It's not clear what's the actionable item here. Can you explain?

The docs are up to date. Are you saying we need to update the error message?

lidforce commented 7 months ago

изображение I think it would be worth adding, when trying to import a component, to have it immediately imported from next-client-cookies/server instead of next-client-cookies as it is now.

IgorCassolli commented 7 months ago

image

Hi, someone can help me with this error?

moshest commented 7 months ago

@LidForce I think it will be solved on the next version, when we remove support for deprecated objects. I agree it would be better to just use a different name and avoid this confusion.

For now, I would update the error message to be:

Missing `<CookiesProvider>` from "next-client-cookies/server"
moshest commented 7 months ago

@IgorCassolli I'm afraid it's not relevant for this issue. Please check our demo folder for a working example and use StackOverflow for bugs on your setup. If you still think there is a bug on this library please open a new issue.

moshest commented 7 months ago

Released under v1.1.1