You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consthandleDeleteSite=async(site: SiteBySlug)=>{awaitdeleteSite({slug: site.slug}).unwrap().then(()=>{navigate('/')showToast({description: `${site.domain} was removed from your account`,duration: SUCCESS_TOAST_DURATION,})}).catch((error)=>{showToast({status: 'error',description: error?.data?.detail||INVALID_RESPONSE,})})}
As we can see once the site has been removed then it should redirect to the '/' url. And I shouldn't see any slug in the URL. But I see that the sites array isn't empty and useEffect takes the first site from the sites array and set its slug to the URL.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello.
My goal is:
To remove a site I have the following logic:
Optimistic update logic:
As we can see once the site has been removed then it should redirect to the '/' url. And I shouldn't see any slug in the URL. But I see that the sites array isn't empty and useEffect takes the first site from the sites array and set its slug to the URL.
Can I update sites array directly after removing?
Beta Was this translation helpful? Give feedback.
All reactions