yurisldk / realworld-react-fsd

A social blogging site powered by React, Zustand, React-Query on FSD (Feature-Sliced Design) architectural methodology.
https://realworld-fsd.netlify.app
MIT License
294 stars 59 forks source link

Implement changes due to Article DTO changes #17

Open Dodje opened 1 week ago

Dodje commented 1 week ago

As starting point here are some changes which were mentioned in the comment: https://github.com/yurisldk/realworld-react-fsd/issues/16#issuecomment-2332246375

And

netlify[bot] commented 1 week ago

Deploy Preview for realworld-fsd ready!

Name Link
Latest commit 225adcc7da713e6e6a23ab8cf59feff290e3d186
Latest deploy log https://app.netlify.com/sites/realworld-fsd/deploys/66e06eb0ba4f1e00088954fb
Deploy Preview https://deploy-preview-17--realworld-fsd.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

yurisldk commented 1 week ago

@Dodje sorry for the dalay.

I made some changes with favorite/unfavorite model. You can check that out.

As you mentioned, requests do not return up-to-date data in the case of an optimistic update, but cached data, we need to make changes to ignore the cache in certain cases, after that the main tasks will be done and the next goal is review and MR

Dodje commented 6 days ago

I'm also sorry for delays, it just happens to coincide with vacation, but I'm trying to be online :)

we need to make changes to ignore the cache in certain cases

What would you suggest here? I'm not familiar with ReactQuery. But It seems like we are going to fix backend bug on frontend, which is not good at all..

Sadly backend is not working again, getting 500

Some update: As I can see, there is the invalidation request queryClient.invalidateQueries({ queryKey: ArticleQueries.keys.root }) which makes our articles queries to refetch the data.

So we have onError method which changes state to previous, and on success we can do nothing actually. Or I would actually suggest not to do anything at all and wait till backend fixes it's issues. Because when we update the page we will see false state of favorite button which is confusing confusing. But I believe it is not a frontend issue...

What do you think?