connect icon indicating copy to clipboard operation
connect copied to clipboard

Missing event for `doOpenAuth` failure

Open jjenzz opened this issue 3 years ago • 7 comments

I'm using react-connect but seems applicable to connect also.

When calling doOpenAuth in an incognito window, the auth window doesn't open and my app gets stuck in "loading" state.

It would be really helpful if there was a way to detect a failure so I can communicate that in the UI.

Video here: https://twitter.com/jjenzz/status/1485244796470009858?s=20

jjenzz avatar Jan 23 '22 14:01 jjenzz

I agree, this would be helpful. Are you getting any feedback in the console as to why it is failing?

fbwoolf avatar Jan 23 '22 15:01 fbwoolf

Looks like something to do with the connect-ui package:

image

I'm using https://remix.run which uses esbuild if that helps at all.

jjenzz avatar Jan 24 '22 12:01 jjenzz

This issue is caused by esbuild not supporting dynamic imports via plugins. When Connect fails to find a wallet (e.g. in incognito if wallet plugin is not enabled in incognito mode), it attempts to open the modal: image and fails due to esbuild lack of dynamic imports support.

He1DAr avatar Jan 25 '22 01:01 He1DAr

Thanks for looking into that, I assumed something like that would be the case as I have had other issues with esbuild up to this point.

The ticket is about providing an onFailure event of some kind though because there is no way for my app to know something like this happened currently (e.g. connection drops and dynamic import fails).

jjenzz avatar Jan 25 '22 11:01 jjenzz

Thanks for looking into that, I assumed something like that would be the case as I have had other issues with esbuild up to this point.

The ticket is about providing an onFailure event of some kind though because there is no way for my app to know something like this happened currently (e.g. connection drops and dynamic import fails).

@jjenzz have you tried wrapping your component with error boundary?

He1DAr avatar Jan 25 '22 14:01 He1DAr

I tried wrapping doOpenAuth() in a try {} catch(e) {} before which didn't catch it and have just tried an ErrorBoundary without success also.

jjenzz avatar Jan 25 '22 18:01 jjenzz

I'll review this issue with @sabbyanandan, @saralab and @janniks soon. 🙏

markmhendrickson avatar Apr 04 '22 12:04 markmhendrickson