RocketChat / EmbeddedChat

An easy to use full-stack component (ReactJS) embedding Rocket.Chat into your webapp
https://www.npmjs.com/package/@embeddedchat/react
107 stars 214 forks source link

[BUG] Attachments sometimes fail to render on initial loads. #533

Open Spiral-Memory opened 3 months ago

Spiral-Memory commented 3 months ago

Description:

Attachments don't render properly on the first deployment without visiting the RC app first.

Steps to reproduce:

  1. Deploy Embedded Chat.
  2. Immediately send multiple different attachments such as photos/videos, etc.
  3. Notice that they won't render properly.

Expected behavior:

Attachments should render properly.

Actual behavior:

Attachments render only when you first visit Rocket Chat and then refresh the EC app.

Note: I'm unsure whether this issue is related to Embedded Chat or Rocket Chat. Also, the issue is hard to reproduce, so not attaching a video.

JeffreytheCoder commented 3 months ago

@Spiral-Memory Great find! I had this issue for a long time...any idea why the files won't render?

Spiral-Memory commented 3 months ago

Nope.. but if you just open rc once and refresh ec. It will start to render..

Why it happens is unknown !

JeffreytheCoder commented 3 months ago

Nope.. but if you just open rc once and refresh ec. It will start to render..

Why it happens is unknown !

I did this but it still doesn't render on my side...could you share a screen recording?

Spiral-Memory commented 3 months ago

Sometimes, that happens too 😂 but it mostly works..

Spiral-Memory commented 3 months ago

The exact cause is unknown !

JeffreytheCoder commented 3 months ago

I found out the issue - I disabled the Settings -> File Upload -> Protect Uploaded Files and the files render perfectly :)

file-not-rendered

I'm updating the Readme so that EC contributors are aware of this

Spiral-Memory commented 3 months ago

Hey, but why ? Why will i disable the option to protect uploaded files ?

Let's not keep it in readme.. it's a vague solution with no explanation involved. also the issue happens even if we login with admin account on EC. Let's keep the solution here to keep track.

JeffreytheCoder commented 3 months ago

Check out this existing issue in RC-Electron.

Basically, the download link is opened in the default browser, not in the RC client (EC in our case). This is why in your case, you must log into RC in the browser before being authenticated to see the files.

Looks like this is an unsolved issue since 2016...so disabling the file protection option is a workaround for now

Spiral-Memory commented 3 months ago

Great find, in my opinion, let's keep this issue and solution here.. or maybe I'll ask to include it in the FAQ.. Keeping it in readme won't be good in my opinion !

JeffreytheCoder commented 3 months ago

well it's better to let more people know about this issue and the workaround...putting this on the FAQ is a good idea

Spiral-Memory commented 3 months ago

Awesome !

sidmohanty11 commented 3 months ago

Good find @JeffreytheCoder !