I'm trying to hide things optimistically when they get deleted but it seems it's not working. What am I missing?
Here is a sandbox showing the behaviour:
https://codesandbox.io/p/sandbox/kind-benz-fkhhjr
#Jankiness in optimistic ui
1 messages · Page 1 of 1 (latest)
Remove the redirect and simply return the json response and it should work fine
It seems like the optimistic delete does not work at all in this example. Even after I return a json response
The rest is the logic. For example, you can uncomment out the opacity style on deletion (better yet, since there's multiple actions you can do: fetcher.formData?.get('_action') === 'delete')
But there's only one fetcher per component..
And the opacity was to indicate pending state..but I want to remove it immediately
See how Ryan does it
https://www.youtube.com/watch?v=EdB_nj01C80&t=1s&ab_channel=Remix
Instead of adding pending states and busy indicators while we wait for the server to process a mutation, we already know what the UI will look like when its done. Skip the spinners with Optimistic UI!
Learn more at https://remix.run
Ah, I see, let me debug it a bit.
Okay
@olive bough have you tested this locally?
Cause I tried it in a local env and not codesandbox, and it seems to be working as intended?
In local env there's some jumping around
https://watch.screencastify.com/v/x5vJ6fArLjBJzUgf2UlN