processing / processing/p5.js-web-editor

Discussion: deleting an asset should remove it from projects

Open
#2,979 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area: AWS S3 Enhancement
Dominant language
JavaScript
Stars
1.7k
Forks
1.7k
Avg merge
3d 4h
Merged PRs (30d)
8

Description

Increasing Access

It is confusing for a sketch to contain an asset which no longer exists.

Feature enhancement details

Let's say that I create a sketch and upload an image to it. Then I go to the "My Assets" page and delete that file. What should happen to the sketch?

Screenshot 2024-01-30 10 05 07

Right now we do not modify the sketch at all when the asset is deleted. The image (image.svg) will still be listed in the files menu of the project. But the file itself no longer exists, and cannot be previewed or used in the project. Trying to load the image with the p5 loadImage() function it won't work, and the error messaging is very confusing because it references the actual URL of the asset ("https://assets.editor.p5js.org/6457f440a66277001a43e859/201273ad-0121-44e1-a5b4-585ea4d9fb8e.svg") rather than the local file path ("image.svg").

Screenshot 2024-01-30 10 28 56

It also causes a bug where the sketch containing the deleted file cannot be downloaded. I fixed that bug by ignoring the deleted file, but that feels like a bandaid solution. The root of the issue is more fundamental -- why do we have projects containing files which do not exist?

I'm open to discussion on how we should handle this situation. My opinion is that when someone deletes an asset we should remove it from from the files array of any projects.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the My Assets deletion flow and how project files are stored in the files array. Reproduce the case by uploading an image, adding it to a sketch, deleting the asset, and inspecting the project and download behavior. Done means deleted assets no longer remain in project files and the resulting sketch handles download and image loading consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
full-stack
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.