Next.js Discord

Discord Forum

Need a better logic

Unanswered
Glitch guy posted this in #help-forum
Open in Discord
Avatar
it's a todo app and stored as array of objects [{..}], so for each user action i have to make an api call (CRUD separately for each) to update the action then it will make another call to db to get the updated tasks then updating ui. so there is like 2-3 sec delay.

to solve this i will create a local task list which the user action is performed locally for faster ui updates. then there will be 3 different array for CUD updates ( want to make separate api call for each ) to keep track of the actions or just a queue of user action then makeing api call in the background. thus handling fast ui updates and slow api calls

i am feeling like this is not good enough, there might be a better way to handle this right?

1 Reply

Avatar
@Asian black bear I can't come up with any, let it be for now I will delete it after a while