I’m trying to speed up the content loading on my pages. E.g currently, I have a workflow set up like this: IF the page is loaded and the current user is logged out, THEN go to page login.
Would it be more efficient to structure the workflow as: If the user is logged out, THEN go to login? Or does this not affect the loading speed?
Let me know if you need any more changes or additional information!
Are you using a “When page is loaded” event? If so, make sure you put the condition on the event and not the go to page action and this will result in a 302 redirect rather than a 200 redirect. This means the redirect comes from the server rather than the client and the page will not be loaded at all. Feel free to post pics of your workflows if you’re unsure
From my point of view, you should set an event User is logged out instead of using on page is load. It’s not really faster, but it will apply at any moment if the user is disconnected, not just validate this on page is load.
The first one looks fine. Are you experiencing that the redirect is slow? If so, what’s the url of the page?
The second one I don’t understand. Why are you using actions to show the elements rather than making them visible by default or using element conditions?
I would do both. I don’t think the user logged out action causes a 302 redirect so I’d only use that for when users are logged in on page load and then log out
Because I experienced that the content on the page was displayed before the user was verified as logged in or verified to actually have access to the page. I redirect users without the proper access to the login page or a 404 page.
Actually I just tested this and the user is logged out event does cause a 302 redirect. So this is a better solution when wanting to redirect logged out users
I conducted a new test and set the header, navigation, and footer to be visible upon page load. I added only two workflows:
1. When the page is loaded and the current user is logged out: Redirect to the index page.
2. When the page is loaded and the current user’s access does not include this page: Redirect to the 404 page.
This way, the header, footer, and navigation are shown before the user is redirected if they don’t have the appropriate access.
Absolutely. I prefer to use User logged out and go to page because of that. No condition, one action. But also because this apply automatically if user is logged out. Not just a check on page is load. Often, this is included un header reusable element.
Your conditions require data to load. So it continues doing it’s thing.
If you want to keep data loading down while running a check, an alternative solution is to make a page that acts as a gatekeeper. That page just needs to load whatever you require then redirect your user accordingly.
If you need some SEO you can just attach your content type to the page. That’s how my index works for one of my apps. I learned this from the Flusk team.