Trix: Safari reloads uploaded images whenever the content is changed

Created on 5 Nov 2019  路  3Comments  路  Source: basecamp/trix

When using Safari, an editor with images attached will reload uploaded images when content is changed.

This does not occur on Chrome or Firefox on macOS, but I haven't tested Windows.

I have tested this on trix-editor.org and my own rails server. On my rails server, this happens both when uploading an image, and also when using an image that has already been saved to the content. The requests appear in my rails logs too, which means Safari isn't caching them.

Steps to Reproduce
  1. Go to trix-editor.org in Safari
  2. Upload an image anywhere in the document
  3. Open the web inspector to the "Resources" tab
  4. Make some changes to the content
  5. Notice the additional images in the sidebar
Details
  • Trix version: 1.2.1
  • Browser name and version: Safari 13.0.2
  • Operating system: macOS 10.15.0

Most helpful comment

I was experiencing this issue as well. After several hours of debugging, I found Safari being the culprit here. Safari applies additional settings while the Web Inspector is opened. By default, disabling caches is one of them, I assume.

There are two small buttons for configuring Safari's caching behavior in the top-right of the "Network" tab:
Cache buttons in Network tab

The left button toggles Safari's caching behavior while debugging (blue icon = caches disabled, grayish/black icon = caches enabled).

Enabling caching fixed the described issue for me on trix-editor.org.

All 3 comments

I have noticed the same thing happens if you navigate away from the page then navigate back to the page with an uploaded image in Safari.

I was experiencing this issue as well. After several hours of debugging, I found Safari being the culprit here. Safari applies additional settings while the Web Inspector is opened. By default, disabling caches is one of them, I assume.

There are two small buttons for configuring Safari's caching behavior in the top-right of the "Network" tab:
Cache buttons in Network tab

The left button toggles Safari's caching behavior while debugging (blue icon = caches disabled, grayish/black icon = caches enabled).

Enabling caching fixed the described issue for me on trix-editor.org.

@adamdebono there is another problem with images being reloaded in Safari, related to cache headers. You might want to have a look at: https://github.com/rails/rails/issues/37766

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madikarizma picture madikarizma  路  5Comments

lanzhiheng picture lanzhiheng  路  4Comments

marpstar picture marpstar  路  5Comments

javan picture javan  路  4Comments

emilbruckner picture emilbruckner  路  5Comments