Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Handle multiple images using oppia-thumbnail-uploader component and don't upload image immediately #20292

Open
AFZL210 opened this issue May 10, 2024 · 0 comments
Assignees
Labels
bug Label to indicate an issue is a regression

Comments

@AFZL210
Copy link
Member

AFZL210 commented May 10, 2024

Describe the bug

The oppia-thumbnail-uploader component uses localStorage to temporarily store images. But, if we have multiple images, i.e., multiple oppia-thumbnail-uploader components on a single page, then it's hard to know which image belongs to which component as the key is unknown.

The second issue is that we upload the image as soon as we confirm the upload, but we would like to upload the image only when the user saves changes in the parent component, i.e., upload images when needed.

The issue has two parts:

(a) Emit the filename/key when saving an image to localStorage so the parent can listen to that event for a particular image.

Suppose we need multiple images to be uploaded when creating something. In this case, the entityId is unknown, so we use localStorage strategy to temporarily store images in session storage. We then send the image blob data to the backend and handle the image upload there. However, the issue here is that we don't know which key the image is stored under in localStorage.

(b) Update this component so that the parent component has control over when to upload an image.

Currently, when changing the file, the image is immediately uploaded, even if the user closes the main component that uses this. This wastes a lot of storage. So, it would be good if we only upload image when need to,

URL of the page where the issue is observed.

N/A

Steps To Reproduce

N/A

Expected Behavior

(a) We should be able to handle as many images as we want using this component on a single page.
(b) Be able to control when to upload an image.

Screenshots/Videos

No response

What device are you using?

Desktop

Operating System

Linux

What browsers are you seeing the problem on?

Other

Browser version

1.62.156 (Brave)

Additional context

No response

Tips for developers

Before addressing the bug, please identify which PR caused the issue (you can follow the steps here). If you identify the PR, comment on the issue with a link to it. If not, mention the commit hash of the oldest commit you saw the bug on (and the month and year it was made in).

Then, please leave a comment with details of the approach that you plan to take to fix the issue (see example).

Note: If this is your first Oppia issue, please make sure to follow our guidelines for choosing an issue and setting things up. You will also need to show a demo of the fix working correctly on your local machine. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Label to indicate an issue is a regression
Projects
Status: Todo
Development

No branches or pull requests

2 participants