ava / use-http

🐶 React hook for making isomorphic http requests
https://use-http.com
MIT License
2.31k stars 114 forks source link

React 18 StrictMode #369

Open zvi1977 opened 2 years ago

zvi1977 commented 2 years ago

Hi, Are there plans to support React 18 ?

t3db0t commented 2 years ago

Seconding this, I'm getting unable to resolve dependency tree when trying to install on a new React project...

wintercounter commented 2 years ago

It installs fine for me, try with --legacy-peer-deps flag.

zvi1977 commented 2 years ago

It installs fine for me, try with --legacy-peer-deps flag.

Thanks , indeed it installs with this flag , however, in runtime I realized that use-http doesn't work with React.StrictMode and React 18... found a related issue : https://github.com/ava/use-http/issues/368

krishnasaga commented 1 year ago

Did any one found the root cause of what causing this ?

krishnasaga commented 1 year ago

zvi1977 I added my findings of root cause here https://github.com/ava/use-http/issues/368#issuecomment-1336209937.

https://github.com/ava/use-http/issues/368

enriquemorenotent commented 1 year ago

How is it even possible that this library is not supporting v18? :O

krishnasaga commented 1 year ago

@enriquemorenotent what do you men by not supporting ?

enriquemorenotent commented 1 year ago

@krishnasaga Have you tried doing npm i use-http on a React v18 app? It will give you an error.

You can "force it", of course. But it doesn't inspire a lot of confidence.

krishnasaga commented 1 year ago

@enriquemorenotent There reason you receive this error is because of this https://github.com/ava/use-http/blob/031b2ee8e00241fc8585dda7cf0c135eda5a181a/package.json#L17-L19 it is explicitly mentioned in pear dependencies as react 16 or react 17

By resolving this issue and successfully passing all the tests. use-http can start supporting react 18. then we can update the pear dependencies so you will not get that error when you install it.

enriquemorenotent commented 1 year ago

@krishnasaga I am not sure I understand what you are asking me...

flo-sch commented 1 year ago

It will give you an error.

More a warning I would say, this library has not been certified compatible with React v18 yet. I have been using it with React v18 without too much problems other than this issue here with <StrictMode />

If you happen to know a way to make it fully compatible with React v18, feel free to contribute, this is Open Source ;)

enriquemorenotent commented 1 year ago

@flo-sch I would call it a warning, if it actually installed the package. But since it doesn't, I call it an error.

Sadly no, I have no idea how to make it work.

flo-sch commented 1 year ago

Oh okay, I have not used npm in years now, did not know it would prevent to install it 🤷 yarn just warns about the version potentially not supported. the --force flag of npm should work until this issue is resolved

krishnasaga commented 1 year ago

@alex-cory there is a duplicate of this thread which I have mentioned. If it making sense to close one of those could you do it please ?

alex-cory commented 1 year ago

If someone creates a PR for this I'll gladly accept it.

krishnasaga commented 1 year ago

@alex-cory Can I have your permission to copy the code of use-http to use directly in my project without importing, so I can have have that fix in my project without needing to depend on the release and also allows me to battle test it against multiple scenarios.

csvan commented 1 year ago

@krishnasaga it's MIT licensed, you already have permission.

TannerS commented 1 year ago

Is there a timeline on react 18 support? our company pipeline doesnt allow force or using legacy deps when doing npm install

wintercounter commented 1 year ago

Lol, that's something I never heard of. For me 9 out of 10 projects have to use --legacy-peer-deps. Just because a package hasn't been updated since the release of npm v7 it doesn't mean it's a security risk.

TannerS commented 1 year ago

I'm not saying your wrong, but I am gonna say we don't have much of a choice. It's a pipeline hundreds of services use and the commands don't include adding that flag, it only runs npm install and anything else errors out

Sent from my T-Mobile 5G Device Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Victor Vincent @.> Sent: Friday, June 30, 2023 12:57:39 AM To: ava/use-http @.> Cc: Tanner Summers @.>; Comment @.> Subject: Re: [ava/use-http] React 18 StrictMode (Issue #369)

Lol, that's something I never heard of. For me 9 out of 10 projects have to use --legacy-peer-deps. Just because a package hasn't been updated since the release of npm v7 it doesn't mean it's a security risk.

— Reply to this email directly, view it on GitHubhttps://github.com/ava/use-http/issues/369#issuecomment-1614166500, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACDUUD6O3QNK3564LKFGXX3XNZTFHANCNFSM5WTDVHPA. You are receiving this because you commented.Message ID: @.***>

wintercounter commented 1 year ago

So is it a strict rule, or you just cannot modify the command the CI will run? Because in that case, you can just add in .npmrc until this gets resolved.

On Fri, Jun 30, 2023 at 2:36 PM Tanner Summers @.***> wrote:

I'm not saying your wrong, but I am gonna say we don't have much of a choice. It's a pipeline hundreds of services use and the commands don't include adding that flag, it only runs npm install and anything else errors out

Sent from my T-Mobile 5G Device Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Victor Vincent @.> Sent: Friday, June 30, 2023 12:57:39 AM To: ava/use-http @.> Cc: Tanner Summers @.>; Comment @.> Subject: Re: [ava/use-http] React 18 StrictMode (Issue #369)

Lol, that's something I never heard of. For me 9 out of 10 projects have to use --legacy-peer-deps. Just because a package hasn't been updated since the release of npm v7 it doesn't mean it's a security risk.

— Reply to this email directly, view it on GitHub< https://github.com/ava/use-http/issues/369#issuecomment-1614166500>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/ACDUUD6O3QNK3564LKFGXX3XNZTFHANCNFSM5WTDVHPA>.

You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ava/use-http/issues/369#issuecomment-1614590991, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHLJQGZ6CID6NESEGHY5LTXN3B3TANCNFSM5WTDVHPA . You are receiving this because you commented.Message ID: @.***>

TannerS commented 1 year ago

Far as I know the DevOps team controls the pipeline for hundreds of teams so we have no say in how it's ran, and we also don't control the npmrc file, locally yes but in the pipeline it's all DevOps configs.

I really love this lib and don't wanna abandon it but it's the only dep blocking multiple of our services from going to react 18.

That is why I was curious on if there is maybe an estimated time

Sent from my T-Mobile 5G Device Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Victor Vincent @.> Sent: Friday, June 30, 2023 8:06:37 AM To: ava/use-http @.> Cc: Tanner Summers @.>; Comment @.> Subject: Re: [ava/use-http] React 18 StrictMode (Issue #369)

So is it a strict rule, or you just cannot modify the command the CI will run? Because in that case, you can just add in .npmrc until this gets resolved.

On Fri, Jun 30, 2023 at 2:36 PM Tanner Summers @.***> wrote:

I'm not saying your wrong, but I am gonna say we don't have much of a choice. It's a pipeline hundreds of services use and the commands don't include adding that flag, it only runs npm install and anything else errors out

Sent from my T-Mobile 5G Device Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Victor Vincent @.> Sent: Friday, June 30, 2023 12:57:39 AM To: ava/use-http @.> Cc: Tanner Summers @.>; Comment @.> Subject: Re: [ava/use-http] React 18 StrictMode (Issue #369)

Lol, that's something I never heard of. For me 9 out of 10 projects have to use --legacy-peer-deps. Just because a package hasn't been updated since the release of npm v7 it doesn't mean it's a security risk.

— Reply to this email directly, view it on GitHub< https://github.com/ava/use-http/issues/369#issuecomment-1614166500>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/ACDUUD6O3QNK3564LKFGXX3XNZTFHANCNFSM5WTDVHPA>.

You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ava/use-http/issues/369#issuecomment-1614590991, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHLJQGZ6CID6NESEGHY5LTXN3B3TANCNFSM5WTDVHPA . You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/ava/use-http/issues/369#issuecomment-1614625649, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACDUUDYNXIH7XYHUJ2QMYCLXN3FN3ANCNFSM5WTDVHPA. You are receiving this because you commented.Message ID: @.***>