p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

Image caching breaks sketches in production

Open da091005 opened this issue 4 years ago • 1 comments

Nature of issue?

  • Found a bug

Details about the bug:

When uploading a file, it is immediately available when using loadImage with the file name explicitly typed as the argument.

Additionally if you use a variable where the file name is explicitly set as the variable, loadImage works immediately after upload.

BUT: if you “build” the variable ie file=‘files/upload’ + i + ‘.jpeg’; loadImage says the file does not exist. Yet, if you wait ~3 minutes without changing anything it will work.

I don’t know if this is preventable, but I though it was odd that I can immediately access the file explicitly, but when using a built variable as shown above, it doesn’t work for ~3 minutes. I couldn’t find any documentation about file availability after upload.

  • Web browser and version: Safari
  • Operating System: IPad Pro: IOS 14.3
  • Steps to reproduce this bug:
    1. Upload an image file.
    1. loadImage using explicit file path/name as argument
    1. loadImage using variable with explicit file path as argument
    1. loadImage using variable with “built” file path as argument (does not work);
Please view picture uploads. You can see the time i tried to run each tie at the top left. Cannot include a code snippet because the error is time-sensitive to when the file was uploaded.

A85E2D9E-B15A-4836-8AE3-7BDAB0FFDA51 8C008068-62AE-4FD9-82C7-2598AD7FC7DD B23FFA79-5BF1-4111-B4B9-0F96F6948347 BCC85FB5-FF53-4E92-A4D8-98C522B1D007

da091005 avatar Jan 20 '21 07:01 da091005

I have a feeling this is the same issue as #1591 as I'm not able to reproduce on development, but on the production server I am. I think the solution is to serve these through a different server (#166) that doesn't use the same caching.

catarak avatar Feb 12 '21 22:02 catarak