-
Notifications
You must be signed in to change notification settings - Fork 1.8k
bug: Mark as completed not working as intended #1794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Screencast.from.26-03-25.10.58.06.AM.IST.webm |
The problem seems to be happening because all the content is server side rendered in a react server component, so when you check a video as completed it updates it in the db but doesn't re-fetch the data. Possible Solutions:
Also since the state would be centralized it would make the side-effect much more easier like for eg: each of the video card also get's a check mark when you check a video but that is impossible unless you reload the whole page to get the updated content after a video is checked completed (pointed in the image below). If you're fine with it @devsargam i would like to work on implementing the second approach. |
No, we can't do that client side at all. It will just leak all our db and api calls. |
Maybe we can revalidate the cache once someone presses the mark as complete action |
@devsargam What i meant my making it client side is to make a route on the api that the client can hit and api route would return courseData depending on the id passed as query parameter (the db call still happens on the server the client got no idea) And as for leaking api calls it would be a similar call to this which is already in prod (these are probably restricted by CORS so no problem i guess?) One downside: would be you can't have statically generated dynamic routes pages just sitting on the server that the server can just return on a requestIf the above downside is too much then re-validating the cache would make sense but still handling side effect would still be pretty much impossible without a full reload or re-render |
I have done the same created a server component and revalidated the path |
I checked it for the bookmark action it does the same thing so I created a server side component to revalidate any path from client side and called this component in the check component @devsargam |
@Dhaneshwarguiyan The useBookmark() hook also has an issue with the sidebar and cardView i've mentioned it here: #1795 |
@HarshK200 That is happening probably because bookmark component is dependent on addedBookmark state, const [addedBookmark,setAddedBookmark] = useState(bookmark); |
@devsargam There are some linting error in code HammerInput not defined when I run lint:fix and lint:check,what to do? |
Describe the bug
Mark as completed not working as intended the state of markascompleted resets to original state after the sidebar panel is closed
To Reproduce
Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.
It should be marked as completed even though I closed the sidebar and reopened.
Screenshots or GIFs
https://github.com/user-attachments/assets/e7d8f59d-380c-435d-a604-17d4f23a43ce
Info (please complete the following information):
Additional context
It updates the db but does not fetches the latest data when the sidebar is closed and reopened,so state gains its default value and data is not fetched even though state has changed because of the useCallback hook which caches the handler(mark as completed).
The text was updated successfully, but these errors were encountered: