mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2026-03-24 12:56:59 +00:00
[GH-ISSUE #2173] [Bug] The system cannot find the file specified after deleting selected cover image #878
Labels
No labels
2024
2025
2026
acct mgmt
AI
automation
bug
calendar
ci
CJK
cloud
code-block
collaboration
copy-paste
database
data migration
data sync
deploy
desktop
develop
develop
documentation
duplicate
editor
editor-plugin
emoji
export
files
flutter-only
follow-up
formula
good first issue for devs
good first issue for experienced devs
grid
hacktoberfest
HACKTOBERFEST-ACCEPTED
help wanted
i18n
icons
images
importer
improvements
infra
install
integrations
IR
kanban board
login
look and joy
mentorship
mobile
mobile
needs design
new feature
new feature
non-coding
notes
notifications
onboarding
organization
P0+
permission
platform-linux
platform-mac
platform-windows
plugins
program
pull-request
Q1 25
Q1 26
Q2 24
Q2 25
Q3 24
Q3 25
Q4 24
Q4 25
react
regression
rust
rust
Rust-only
Rust-only
Rust-starter
Rust-starter
self-hosted
shortcuts
side panel
slash-menu
sync v2
table
tablet
task
tauri
templates
tests
themes
translation
v0.5.6
v0.5.8
v0.5.9
v0.6.0
v0.6.1
v0.6.4
v0.6.7
v0.6.8
v0.7.1
v0.7.4
v0.7.4
v0.7.5
v0.7.6
v0.7.7
v0.7.8
v0.8.0
v0.8.4
v0.8.5
v0.8.9
web
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AppFlowy-IO/AppFlowy#878
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @GouravShDev on GitHub (Apr 3, 2023).
Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/2173
Originally assigned to: @GouravShDev on GitHub.
Bug Description
After deleting the selected image of a document cover will cause the following exception:
(OS Error: The system cannot find the file specified, errno = 2)
How to Reproduce
Expected Behavior
It should revert back to default no cover image
Operating System
Windows 10
AppFlowy Version(s)
0.1.2
Screenshots
Additional Context
https://github.com/AppFlowy-IO/AppFlowy/pull/2111#issuecomment-1493578791
@GouravShDev commented on GitHub (Apr 3, 2023):
I would like to work on this fix. Since, my PR caused it 😅.
@annieappflowy commented on GitHub (Apr 4, 2023):
@GouravShDev , I commented on the previous PR. I think it's better to go back to the default no image cover state after deleting the current cover image.
@GouravShDev commented on GitHub (Apr 5, 2023):
I need suggestion for the possible solution to this issue.
I was thinking to just check for the cover image before creating image widget for that and if it doesn't exists then remove from the database and return empty sizedbox.
But this doesn't update the current document unless app restarts. Should I go with this approach?
I tried to update current document but this cause sudden weird animation in the ui as shown in this video:
https://user-images.githubusercontent.com/74348508/230054301-2a85f68d-a5d5-489f-80c6-00db0a4f719d.mp4
@hyj1204 commented on GitHub (Apr 6, 2023):
In my opinion, the ideal solution would be to display a pop-up dialog when a user attempts to delete an image that is currently in use. It can be "This image is currently used in the cover, it will be removed from cover after it is deleted. Do you want to delete it and remove it from the cover? " Yes/No
If the user chooses to proceed, the image should be deleted, and the cover should be updated with a refresh animation(that weird animation could make sense here) to indicate the change. It could be a new feature/improvement to do in a new PR.
For now, it would be best to focus on fixing the error first. I think your first approach is suitable for this situation, and it won't cause any disruptive changes for users when they delete an image that's currently in use.
What do you think? @GouravShDev @annieappflowy
@GouravShDev commented on GitHub (Apr 6, 2023):
Definitely agree with you @hyj1204 . I can try adding popup for deleting selected cover image and loading animation but that might take some time. If that first approach is feasible I can create PR for it. And might work on improvement later on.
I found another issue with updating current document cover after deleting selected cover image.
Let's say a image is used as cover for different documents and user deletes that cover image I might be able to update current document but I don't know how can I update all other documents which are using that cover image without app restart.
@hyj1204 commented on GitHub (Apr 6, 2023):
@GouravShDev
That's a really good point. I agree that it can be difficult to keep track of all the pages linked to an image that is going to be deleted. One solution I could think of it is to separate the cover image used on the page from the cover image used in the gallery. This could be achieved by making a copy of the image each time it is applied and saving it with the page it belongs to. By this way, if the user deletes the image in the gallery, it will not affect anything in the pages until the user chooses to delete it. However, this may cause a lot of cover images to be stored with the pages, I am not sure if it is a good solution to solve this problem at this point.
Another feasible solution I could come up with is to follow the way I suggest before, pop up a dialog, then deleting the cover for current page only, and leave the other pages with deleted cover until user restart the app. After restarting the app, any non-existent cover images will disappear(become Sizedbox).
Let me know what you thought about it.
@GouravShDev commented on GitHub (Apr 8, 2023):
@hyj1204 I am going with the approach of showing popup to user and updating current document . Other documents will update when widget get rebuild. I have created Alert dialog ui for it. I'm working on its functionality rn.
Can you suggest if the UI for the dialog is right?
@LucasXu0 commented on GitHub (Apr 10, 2023):
Hey, @GouravShDev. We should add a backup logic for deleting images. If we can't load the image successfully, we have two options: either clear the status of the cover or show the built-in image.
@GouravShDev commented on GitHub (Apr 10, 2023):
@LucasXu0 I have added backup logic in my PR.
But what about alert dialog for deleting image which is current selected ? Should I keep it or remove it? As it difficult to check if image is used in any document cover.
@LucasXu0 commented on GitHub (Apr 10, 2023):
I suggest that we only show the toast if the user deletes the image that's currently being used in the document. @hyj1204 What do you think?
@hyj1204 commented on GitHub (Apr 10, 2023):
@LucasXu0
Yes, I think it is my previous suggestion too. The dialog will pop up only when user intent to delete the cover which is in using in current page. If the image is not used in current page or used in other pages, the dialog won't pop up and the image will be delete immediately.
@GouravShDev
You can use the dialog you already built. I may modify its style later after you code is merged because I gonna refactor all the
StyledDialog(maybe with other predefined widgets) later as an independent PR.