Open-Assistant
Open-Assistant copied to clipboard
Tasks no longer appear after going back to the main site and going to the task again

Reproduction:
- On the website, choose a task type and click on it.
- Go back
- Click on the same task again
Can you see anything going on by checking the backend's docker logs?
I don't think it's on the backend. It looks like when I first enter, the website calls the API for a task, but when I exit and enter the same task again, I don't see a call to the API.
I know what's going on. Its the fact that we're using useSWRImmutable. One way we can fix this is by adding in
useEffect(() => {
if (tasks.length == 0) {
mutate();
}
}, [tasks]);
To all the task pages. That would handle the case where we navigate to a task page, go home, then go back to the task page and the tasks get thrown away.
The other way is to investigate other variants of useSWR. The one issue I had with useSWR is that it kept re-fetching when switching tabs which is something we don't want.
Can I assign this to you @kostiak to test out?
@fozziethebeat Sure, I'll test it out and let you know what I find.
@fozziethebeat wasn't able to getuseSWR to work reliability but I did test your suggestion and it works.
Alright, let's go with whatever works! Can you send that out as a PR? I'll review it high priority
Confirmed fixed