widgets icon indicating copy to clipboard operation
widgets copied to clipboard

Could not find dependency: 'jotai-immer' when using SwapWidget

Open cnasc opened this issue 2 years ago • 18 comments

Bug Description After installing @uniswap/widgets and importing SwapWidget, a DependencyNotFound error for jotai-immer throws.

Steps to Reproduce

Codesandbox here

  1. install @uniswap/widgets per the readme
  2. try to use SwapWidget
  3. error occurs

Expected Behavior After following the installation steps in the readme, SwapWidget is usable without error.

Additional Context image

  • noticed this at first on our Next.js app
  • Tried in a clean react codesandbox to reproduce the issue and confirm it wasn't local to my machine
  • manually adding jotai-immer and qs as dependencies to my project appears to resolve the issue

cnasc avatar Jan 11 '23 14:01 cnasc

Same!

Tomiblanchard avatar Jan 12 '23 12:01 Tomiblanchard

Same, and when I fix it it says error - Error: Cannot find module '***/node_modules/@uniswap/conedison/dist/format'

rharkor avatar Jan 14 '23 15:01 rharkor

Same

zyrm avatar Jan 16 '23 19:01 zyrm

see #404 for a suggestion on a fix/workaround. this should help resolve the conedison issue until we can update that library.

just-toby avatar Jan 25 '23 21:01 just-toby

Had the same issue, solved by doing:

-- npm i @uniswap/[email protected]
-- npm i react/redux
-- npm i jotai-immer

and it should work.

This makes the project building properly and run.

However, in my application it seems that after this I get thousands of deprecated error occuring in an infinite loop. Then the swap button is always greyed out. I don't know if it is linked but I see no other reason for this button to stay deactivated.

image

gilles-hemmerle avatar Feb 27 '23 10:02 gilles-hemmerle

After manually adding jotai-immer,the console loops indefinitely warning:use useSetAtom from jotai instead. image

dai-ki-web avatar Feb 28 '23 03:02 dai-ki-web

Same

wangliyue14 avatar Mar 01 '23 15:03 wangliyue14

And uniswap widget doesn't show some tokens.. wondering it's related to this deprecated warning

wangliyue14 avatar Mar 01 '23 15:03 wangliyue14

same issue as above - After manually adding jotai-immer,the console loops indefinitely warning:use useSetAtom from jotai instead.

nneverlander avatar Mar 05 '23 19:03 nneverlander

For anyone having issues with a bunch of infinite loops about deprecated warnings, add this to your package.json of your project: "jotai": "~1.3.7",

What I noticed was that in the demo code (cosmos) it worked fine, but in newer versions (nextjs etc) jotai was auto-upgraded to 1.18.1 (which has all the weird breaking changes). So the above code simply forces npm to use the compatible jotai version (it gets bumped to 1.3.9 but that's still fine).

victaphu avatar Mar 11 '23 16:03 victaphu

This issue is fixed on 2.47.10, you can remove jotai and jotai-immer from your dependencies.

marcinciarka avatar Mar 14 '23 11:03 marcinciarka

Hm, I can't confirm whether 2.47.10 fixes, upon upgrading and removing I get the following error:

Error: Cannot find module 'node_modules/@uniswap/widgets/node_modules/@uniswap/conedison/dist/provider/signing'

I have attempted creating an alias per the suggestion in #404, however that simply yields a slightly different error:

Module not found: Can't resolve '@uniswap/conedison/provider/signing'

cnasc avatar Mar 14 '23 14:03 cnasc

Hm, I can't confirm whether 2.47.10 fixes, upon upgrading and removing I get the following error:

This is a different issue, caused by some export shenanigans uniswap has. Use the fixes from here - https://github.com/Uniswap/widgets/issues/404 - disabling SSR worked for me.

marcinciarka avatar Mar 14 '23 14:03 marcinciarka

Our swap component is already dynamically imported, unfortunately

cnasc avatar Mar 14 '23 14:03 cnasc

Had the same issue, solved by doing:

-- npm i @uniswap/[email protected]
-- npm i react/redux
-- npm i jotai-immer

and it should work.

This makes the project building properly and run.

However, in my application it seems that after this I get thousands of deprecated error occuring in an infinite loop. Then the swap button is always greyed out. I don't know if it is linked but I see no other reason for this button to stay deactivated.

image

I was experiencing the same issue and I asked on their discord - someone pointed out there is a permit2 prop you can add in the widget (funnily enough i can't see it anywhere in the docs) but it does sort this issue of the greyed out review swap button

keirongulrajani avatar Mar 16 '23 10:03 keirongulrajani

Is there anybody can resolve this issue

nmaddp1995 avatar May 24 '23 15:05 nmaddp1995

Have tried the fixes above but doesn't resolve the issue unfortunately. Is there another potential resolution to this issue?

dawb avatar Jun 28 '23 07:06 dawb

Had the same issue, solved by doing:

-- npm i @uniswap/[email protected]
-- npm i react/redux
-- npm i jotai-immer

and it should work.

This makes the project building properly and run. However, in my application it seems that after this I get thousands of deprecated error occuring in an infinite loop. Then the swap button is always greyed out. I don't know if it is linked but I see no other reason for this button to stay deactivated. image

I was experiencing the same issue and I asked on their discord - someone pointed out there is a permit2 prop you can add in the widget (funnily enough i can't see it anywhere in the docs) but it does sort this issue of the greyed out review swap button

Absolute lifesaver, for those who may have missed it, add the permit2 prop to SwapWidget.

DeveloperTheExplorer avatar Nov 14 '23 22:11 DeveloperTheExplorer