Open-Assistant icon indicating copy to clipboard operation
Open-Assistant copied to clipboard

fix for invalid avatarUrl error

Open owenduncansnobel opened this issue 1 year ago • 2 comments

fix for https://github.com/LAION-AI/Open-Assistant/issues/1985

If the avatarUrl ends up being invalid, it will use the same default value as if the avatarUrl is missing.

I tried to fix it without useState but it caused flickering as Next.js kept trying to fetch the invalid url

Screenshot 2023-03-05 at 8 57 24 PM

owenduncansnobel avatar Mar 06 '23 01:03 owenduncansnobel

Thank you. But this only mitigates the problem. The root problem is we don't update the discord avatar (except for the first login). Can you address this? You need to add the logic to the signIn event in [...nextauth].ts file

notmd avatar Mar 06 '23 13:03 notmd

Thank you. But this only mitigates the problem. The root problem is we don't update the discord avatar (except for the first login). Can you address this? You need to add the logic to the signIn event in [...nextauth].ts file

I can try and attempt this tonight. Would the behaviour you expect then be to update the image url every sign in regardless of it changing? Or first get the user then check if the profile.image differs from the user.image?

owenduncansnobel avatar Mar 06 '23 18:03 owenduncansnobel

I am not really sure how to go on about this, is signin called only when the user signs in with username and pass? or is an outdated session also considered a sign in? we need to update the images just the right amount of times.

AbdBarho avatar Mar 06 '23 18:03 AbdBarho

Thank you. But this only mitigates the problem. The root problem is we don't update the discord avatar (except for the first login). Can you address this? You need to add the logic to the signIn event in [...nextauth].ts file

I can try and attempt this tonight. Would the behaviour you expect then be to update the image url every sign in regardless of it changing? Or first get the user then check if the profile.image differs from the user.image?

Update when image_url change is good, but only update when user signin with discord.

I am not really sure how to go on about this, is signin called only when the user signs in with username and pass? or is an outdated session also considered a sign in? we need to update the images just the right amount of times.

signin is called when the user sign in succeed, no matter what sign in method they use

notmd avatar Mar 06 '23 18:03 notmd

signin is called when the user sign in succeed, no matter what sign in method they use

My question was more on the behavior of next-auth, if it would call signin after a discord session has expired, or just session.

I signed in to our website with my discord only once since we created the app, it won't help us if signin is called only once.

I am going to check the behavior

AbdBarho avatar Mar 06 '23 19:03 AbdBarho

signin is called when the user sign in succeed, no matter what sign in method they use

My question was more on the behavior of next-auth, if it would call signin after a discord session has expired, or just session.

I signed in to our website with my discord only once since we created the app, it won't help us if signin is called only once.

I am going to check the behavior

Let me know what you find/found

owenduncansnobel avatar Mar 07 '23 03:03 owenduncansnobel