File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -81,11 +81,20 @@ const PageBookmarkAction: React.FC<PageBookmarkActionProps> = ({ pageNumber }) =
81
81
82
82
// Handle bookmark removal
83
83
const handleBookmarkRemove = ( ) => {
84
- deleteBookmarkById ( bookmark . id ) . then ( ( ) => {
85
- toast ( t ( 'quran-reader:page-bookmark-removed' ) , {
86
- status : ToastStatus . Success ,
84
+ deleteBookmarkById ( bookmark . id )
85
+ . then ( ( ) => {
86
+ mutate ( ) ;
87
+ toast ( t ( 'quran-reader:page-bookmark-removed' ) , {
88
+ status : ToastStatus . Success ,
89
+ } ) ;
90
+ } )
91
+ . catch ( ( ) => {
92
+ // Revalidate to restore the bookmark state in case of failure
93
+ mutate ( bookmark , { revalidate : true } ) ;
94
+ toast ( t ( 'common:error.general' ) , {
95
+ status : ToastStatus . Error ,
96
+ } ) ;
87
97
} ) ;
88
- } ) ;
89
98
} ;
90
99
91
100
const onToggleBookmarkClicked = ( ) => {
You can’t perform that action at this time.
0 commit comments