Delay Server Connect

I’m trying to understand the “correct” structure for a SPA.

Here is what I have

  1. Template A contains 3 Server Connects
  • SC0 that contains data for the common template
  • SC1 that contains data for view/route 1
  • SC2 that contains data for view/route 2
  1. Views only have the data for the page.

My question is…
If I load view 1, how do I correctly prevent the SC2 from loading
and if I load view 2, how do I prevent SC1 from loading

Sorry, I have asked before but not sure I worded it right, Sure there is a way if someone can just point me there. Thanks so much.

In a SPA, all of the content of the associated views are loaded at once. This means that there is no way that a Server Connect can be prevented from loading.

It is a matter of Pay Now (SPA) or Pay Later (MPA).

Or you can move your server actions on the content pages, where they will be loaded when the route is loaded.

1 Like

Thanks Teodor, I did not know that. When I initially (way back when the routing was first inroduced) tried that, it did not work for me. This give me fresh hope.

However, the main reason for creating a SPA was to have access to a template. With NodeJS templates, this has changed my worflow completely. Looking forward to Friday morning; I have a longer wait than you guys in Europe :+1:

2 Likes

That is what I had originally done, but for some reason I thought that was wrong. I’ll go back to that. Thanks!

But we get a full Friday to play around with it :grin:

1 Like