There are a few things to check, firewall set up correctly? Check out this tutorial How To Use MERN Stack: A Complete Guide | MongoDB. Also try to debug the code and read the error if any when it creates the connection.
I took the liberty to check the address and then your backend. your reset-insert-difuse logic possibly has this bug you mention.
it is very sluggish to return data, it is possible you have forgotten to close the response stream after sending data, or a problem with the codesandbox.
you have to call insert once to populate the table, and it seems it works well after that. but this operation gives timeout, again a possible non-closed stream. the difuse operation seems to respond fast so I will assume it is not a read operation problem from mongo.
while writing the above finding, I noticed codesandbox stops the container if idle for a while, and starts a new container if that happens with new responses. this might be directly related to your first empty list issue.
I suggest you try your code on your pc running both backend and frontend (change corresponding addresses) to rule out any cloud service delays. and btw you need to implement a security measure to your back end when you solve the problem. though it does not much, insert operation currently can fill your db infinitely.
post edit: codesandbox goes idle in a few minutes. and whenever you open that page in that idle time, your page first returns an empty dataset, and after another 15-20 sec full data returns showing codesandbox is back online. it fetches data well after that.