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

fix notes image upload #408

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

arpitdalal
Copy link
Contributor

Image upload for notes has a bug where only adding an image to an existing note deletes the old one and only adds the new one. (See below video)

edit.images.not.working.correctly.mp4

This happens because the file entries without File are being stripped away by this function and since the existing images are only being passed as id in a hidden field, they're being stripped away.
As a solution, I've updated that function not to strip away any images that have id, see here and update related code in transform and prisma query.
See this video after this fix

edit.images.working.correctly.mp4

Let me know if you need me to make any changes.

Test Plan

I couldn't find any tests already written for this, so haven't updated anything.

Checklist

  • Tests updated
  • Docs updated

Screenshots

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this! I've adjusted the approach and I think it simplified things quite a bit. I appreciate you bringing this to my attention! I'm recording the video for EpicWeb.dev where we build this part of the app right now so it was very timely :)

@kentcdodds kentcdodds merged commit c7147cd into epicweb-dev:main Aug 29, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants