Hi! I need a quick elaboration on DDP connection and rendering.
Let’s say when I first open a website, there are 150 posts to be rendered. In this case, a DDP connection should be established first. Then, all the published data that I subscribed to get cloned to DB and rendered. I noticed the
subscription turns to a
ready state only when all the 150 posts are cloned to local DB. In other words it seems to work like this:
- DDP connection established.
- Start cloning data from server to client.
- When all the data is cloned,
Between steps 2 and 3, users see the posts are rendered as they are being cloned to the DB. Instead of showing the user an incomplete list of posts, I hide all the posts at step 2 and show all of them at once at step 3.
Let’s say I navigate away to
/posts/1 and then come back to
/. It looks like there’s still some loading time; in other words, it takes a few seconds for
subscription.ready() to be true. My guess for the reason is that when you navigate to
/posts/1 all the posts that we had inside local DB get wiped, and we have to clone them again. Is it true? If not, what’s really happening?
In my app, I expect the user to go back and forth the
/posts/ page and
/posts/:id page pretty often. Right now, everytime the user goes back to the
/posts page he needs to wait for a couple of seconds for the posts to be loaded. I feel like there must be a smart solution for this because it’s the same data that he already viewed, and should be able to be cached.