frontend
frontend copied to clipboard
feat(download): delete finished file without refresh
What if user delete all records in current page? The list will be empty while there’s still items in other pages.
What if user delete all records in current page? The list will be empty while there’s still items in other pages.
Maybe we can refresh the finished list when item deleted, or only refresh when the list is empty?
Both approaches have gaps.
-
If we refresh the list after item deleted: The page number of the list will be reverted to page 1 (Note: this page is loading in an endless "append-only" mode). This makes not much difference comparing to existing "refresh page" way.
-
If we refresh the list when the list is empty: Imagine we have pagination with size of 2 items/page. We have items: 0,1,2,3,4, the pagination overview before delete: Page 0: 0, 1 Page 1: 2,3 Page 2: 4 The user now only loads one page (Page 0), and he delete item 1. Now we have following items: 0,2,3,4, and the user click "Load More" to load page 1. Her's the tricky part: the backend will query items from Page 1, the result is: 3,4, and the items displayed to the user will be: 0,3,4. Item 2 will be missing in this case, unless user refresh the page.
Consider the complexity of this problem, I choose the simplest way: refresh the page after item deleted. We can surely resolve this problem with no page refreshing, but the effort is huge. Possible solutions: Refactor the page as indexed pagination (like in dashboard), instead of loading items in appending mode.