Skip to content

AssetSize bar disappears when deleting an asset #2243

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

Closed
lindapaiste opened this issue Jun 12, 2023 · 1 comment · Fixed by #2248
Closed

AssetSize bar disappears when deleting an asset #2243

lindapaiste opened this issue Jun 12, 2023 · 1 comment · Fixed by #2248
Assignees
Labels
Bug Error or unexpected behaviors

Comments

@lindapaiste
Copy link
Collaborator

p5.js version

No response

What is your operating system?

None

Web browser and version

No response

Actual Behavior

totalSize becomes undefined and the storage space UI disappears from the "Assets" tab when you delete a file.
image
image

Expected Behavior

image

Steps to reproduce

Steps:

  1. Go the the /assets page on your account.
  2. Delete an asset.
@lindapaiste lindapaiste added the Bug Error or unexpected behaviors label Jun 12, 2023
@lindapaiste lindapaiste self-assigned this Jun 12, 2023
@lindapaiste
Copy link
Collaborator Author

lindapaiste commented Jun 12, 2023

I found the problem. The state.assets.totalSize property gets wiped out on the DELETE_ASSET action. There is no totalSize in the returned state.

case ActionTypes.SET_ASSETS:
return { list: action.assets, totalSize: action.totalSize };
case ActionTypes.DELETE_ASSET:
return { list: state.list.filter((asset) => asset.key !== action.key) };

We can fix this in the reducer by returning the new totalSize after subtracting the size of the deleted asset. We could also consider including the new totalSize in the API response for the deleteObjectFromS3 handler.

raclim added a commit that referenced this issue Jan 10, 2024
Fix #2243 - AssetSize bar disappears when deleting an asset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error or unexpected behaviors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant