Debugging, UX improvements, and performance fixes.
Last night I was thinking about how poor the performance of this setup is and how the UX is terrible.
Another concern, after reading about what happened to another SAAS who was giving stuff away for free was how to get people to try and like codeinteractive without it occurring a big cost for me. I would have to be able to run C# in the browser, and it would have to be a simple tutorial. Maybe a blazor webassembly runtime? I'll have to think about that later.
I was also thinking about ditching the whole code-server thing, but decided to try and make things work as good as possible with what I already have first so I can start getting some user feedback.
I was also thinking about the way courses are set up, and how I force apply changes on each step. Would users mind if their code is overwritten by the course code? Could I save their changes and let them evolve their code through time? I did some digging and the best way to do that seems to be with patch files:
# save your working copy changes git diff > some.patch # re-apply it later git apply some.patch
Okay, back to work. Time to figure out why the container keeps getting reset.
That was quick. The reason is that change-step gets called every time the page rerenders, and that happens when I make changes to the frontend code and Next rerenders, so that's a non issue.
Next up, I need to hide unnecessary files like bin and obj directories from the file explorer view.
Now, I'll try to clean up the view more, removing the timeline, open editors and other unnecessary things from the code-server ui
I cleaned up everything except the timeline and outline. Looks good enough though, so I'll leave it be.
I hid obj, bin, and some other stuff from the explorer, and now it's looking pretty nice.
Seems like im calling /change-step before the environment is ready. I will have to add a check on the frontend that waits for /init-course to finish before calling anything else.
I just noticed this in the log output:
2024-11-15T22:39:36.373663400Z [22:39:36] [File Watcher (parcel)] Watcher restarts because watched path got created again (path: /tmp/rokokovac98/testing-in-dotnet)
Am I deleting the directory every time i set up the environment? I should probably not be doing that.
I removed the deleting of the directory and reloading the page seems to be much faster.
I spent a lot of time refactoring the code to try and fix the errors caused by calling /change-step before the environment is ready, but I don't think I've achieved much. All the setup code is now being called sequentially from the client, but I can still see some errors popping up. I guess I'm too tired to think about this now.
I've also spent a lot of time trying to resolve the tests taking too much to run for the first time. The first restore takes about 25 seconds. I added a dummy csproj with all dependencies, and I run a dotnet restore as soon as the course is started. This way, by the time the user starts their tests, hopefully, the restore will have finished. The nugets are cached and shared, so as long as they take more than 25 seconds to get to stage that can run tests, we're good. At least that's the idea.
However, while making many of these changes, I've messed something up. Now I'm too tired to figure out what's wrong, so I'll leave that for tomorrow.
Time to go to sleep (should've gone 2 hours ago).